getJSON

getJSON

Hi,
I have an issue with the getJSON method, here is the code of the jquery:

  1. $(document).ready(function(){
  2. $.getJSON('../php/functions/user_info.php', {id: id}, function(data){
  3. alert(data);
  4. });
  5. });
the php code at  ../php/functions/user_info.php is:

  1. <?php
  2. require_once 'connection.php';
  3. $link = conenct('localhost', 'root', '', 'w_db');

  4. mysql_query( "SET NAMES utf8" );
  5. mysql_query( "SET CHARACTER SET utf8" );
  6. mysql_set_charset('utf8', $link);

  7. $id = $_POST['id'];
  8. $id = mysql_real_escape_string($id);

  9. $query = mysql_query("SELECT * FROM users WHERE id = '$id'") or die('Invalid query:'. mysql_error());
  10. $userInfo = mysql_fetch_assoc($query);

  11. echo json_encode($userInfo );
  12. ?>
When I am running the page no alert pops out. What is wrong with my code?!?!?

tnx!!