使用jquery从mysql获取信息

i have mysql database for i fetch information using json for example:

$sql ="SELECT * FROM parent WHERE id = '$name'";       
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
 {
$abc=$row[id];
}
echo json_encode($abc)

Now how can i display this json encoded element in my main html file using jquery? what i want to do is based on this fetched element i want to do some if else operation.

for example:

if(value of row[id](should be achieved using jquery) ==null)
{}
else
{}

I am looking for something like $(xxxx).somefunction() Thanks in advance.

You could use jQuery to convert the JSON into a JavaScript object and then add the properties of the object into your html.

jQuery.parseJSON( json )

Add the JSON from the database to your webpage through:

echo "var myJson = ".json_encode($abc);

Then use jQuery to parse the JSON through:

myObject = jQuery.parseJSON(myJson);
alert(myObject.id);

You can create a javascript var:

echo('var test = ' . json_encode($abc));

Now you can acces the var "test" with javascript.