[SOLVED] Json on php side after getJSON call
Posted: Mon Aug 13, 2012 12:26 pm
Hi,
Hi,
I have an issue with the getJSON method, here is the code of the jquery:
the php code at ../php/functions/user_info.php is:
When I am running the page no alert pops out. What is wrong with my code?!?!?
tnx!!
Hi,
I have an issue with the getJSON method, here is the code of the jquery:
Code: Select all
$(document).ready(function(){
$.getJSON('../php/functions/user_info.php', {id: id}, function(data){
alert(data);
});
});
Code: Select all
<?php
require_once 'connection.php';
$link = conenct('localhost', 'root', '', 'w_db');
mysql_query( "SET NAMES utf8" );
mysql_query( "SET CHARACTER SET utf8" );
mysql_set_charset('utf8', $link);
$id = $_POST['id'];
$id = mysql_real_escape_string($id);
$query = mysql_query("SELECT * FROM users WHERE id = '$id'") or die('Invalid query:'. mysql_error());
$userInfo = mysql_fetch_assoc($query);
echo json_encode($userInfo );
?>
tnx!!