> php JSON (encoded) Result: > ["\/uploads\/Argentina.gif","\/uploads\/Australia.gif","\/uploads\/ > Brazil.gif","\/uploads\/Cameroon.gif"]
That is an array, not a JSON object (http://en.wikipedia.org/wiki/ JSON) Two completely different things On Oct 1, 10:32 pm, James <james.gp....@gmail.com> wrote: > In your PHP, you can do this: > > $data = array('/uploads/Argentina.gif', > '/uploads/Australia.gif'); > echo json_encode($data); > exit; > > In your JS code for your getJSON callback: > > function(data) { > $.each(data, function(i, path) { > alert(i+': '+path); > }); > }); > > On Oct 1, 1:02 pm, Colossus <david.stoffe...@googlemail.com> wrote: > > > h...@all. > > > I have a little problem with JQuery and JSON, because it's my first > > JSON testing Project. > > > In the documentation i found this:http://docs.jquery.com/Ajax/jQuery.getJSON > > But i do not understand how it works with an JSON array. :( It's an > > other JSON structure then mine. > > I simply want to play around with it. And trying to load some images > > in a img src tag. ;) > > > My jQuery Function is: > > $.getJSON("index.php?action=JSON_directory", > > function(data){ > > // and this is my prob, see my php result. > > }); > > }); > > > php JSON (encoded) Result: > > ["\/uploads\/Argentina.gif","\/uploads\/Australia.gif","\/uploads\/ > > Brazil.gif","\/uploads\/Cameroon.gif"] > > > Hope anyone can help a lame dog over a stile. ;) > > > Many THX. :)