[jQuery] JSON , PHP, MySQL, and jQuery
I'm having trouble parsing JSON in Javascript.
The response i'm getting from PHP when making a request is:
[
{'name': 'John', 'lastName': 'Doe','age':'25', 'height': '170',
'weight': '120'},
{'name': 'Jane', 'lastName': 'Doe','age':'26', 'height': '175',
'weight': '121'},
{'name': 'Jack', 'lastName': 'Doe','age':'27', 'height': '180',
'weight': '122'} ]
How would I go about parsing this in Javascript? Am I not encoding it
correctly on the PHP Side?
Here's my JAVASCRIPT:
$.get("includes/functions_inside.php", {"function" : "getAppList"},
function(data, textStatus){
alert( data[0] );
}
);
Here's my PHP:
$AppListQuery = $insideDB->customQuery($query);
$rows = array();
while($r = mysql_fetch_assoc($AppListQuery)) {
$rows[] = $r;
}
print json_encode($rows);
Thanks in advance!