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.
Add the JSON from the database to your webpage through:
Then use jQuery to parse the JSON through: