-Mike
On Thu, Oct 1, 2009 at 9:50 PM, MorningZ <morningz@gmail.com> wrote:
That is an array, not a JSON object (http://en.wikipedia.org/wiki/
> php JSON (encoded) Result:
> ["\/uploads\/Argentina.gif","\/uploads\/Australia.gif","\/uploads\/
> Brazil.gif","\/uploads\/Cameroon.gif"]
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:
>
> > Hi@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. :)
No comments:
Post a Comment