I have an AJAX call that returns the data from PHP
echo json_encode( $json_response);
and the result is as follows
[{"name":"Sprouts.......}]
I then loop through it with JQUERY
$.each($.parseJSON(data), function(i, obj) {
var name = (obj.name);
var address = (obj.address);
});
This works perfectly fine, but I am trying to add a name (child) to it so that I can have other children. I used the following
json_encode(array('storedata' => $json_response))
to add the name storedata which returns
{"storedata":[{"name":"Sprouts....
I have tried looping through with
$.each($.parseJSON(data.storedata), function(i, obj) {
var name = (obj.name);
var address = (obj.address);
});
but something is wrong with the syntax because the data.storedata is undefined.
What is the correct syntax and/or correct way to do this. Thank you for any and all help.