Hi,
I have looked at this code and I cannot see the problem. If anyone can spot the error then I will be very grateful.
Basically I am returning an array from a .PHP in json format the code is here.
echo json_encode($anarray);
the array is made up like "vegetable" => "leek" etc etc.
Now when the array is echo'd back onto the page for the jQuery to pick up I use this code.
$.post('../ajax/list.php', {"test":"test"} , function(data)
{
$.each(data ,function(name,value)
{
console.log(name + '=' + value);
});
});
Now the json object (data in the above code) returns this
"[{vegetable":"leek" , "price":50}]
This is as expected but when run over the $.each all that happens is it says invalid identifier.
There must be a simple error there but so far I cannot spot it. Can anyone else see it?
Thanks
Noel.