I have the following JSON structure, being returned from an AJAX call (pseudo values)
[
{
"id":"14",
"product_title":"Foo Bar v1.2",
"discount":"10% Off - New price: $97",
"vendor":"foobar"
}
]
Here is my AJAX routine.
$.post('Ajax.php',function(res){
alert(res.product_title);
});
},'json');
However, the alert says “Undefined”, even though it is clearly not (Firebug).
I tried doing a $.each(); on the res, and it appears the only “key” in there is “0”.
What am I doing wrong here? Is it the way I am processing the structure? Cheers!
try :
you can also write: