views:

80

answers:

1

I'm using jQuery to get and parse JSON using example flickr service : http://api.jquery.com/jQuery.getJSON/

everything works fine if i use flickr url , the problem starts when i try to get my own service.

It works when I save the output and read it from file but i doesn't work from the server url. Firebug shows two that the object is null which is obvious but it also shows something like this :

GET http://myurl.xx 200 OK 107ms


Date Sat, 26 Jun 2010 10:24:08 GMT
Server Apache/2
X-Powered-By PHP/5.2.10
Set-Cookie SESS1faf247ad9843d9dd296b3673ae414f3=1e90f24286485ce326718211ed258733; expires=Mon, 19-Jul-2010 13:57:28 GMT; path=/; domain=.myrul.xx
Expires Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified Sat, 26 Jun 2010 10:24:08 GMT
Cache-Control store, no-cache, must-revalidate, post-check=0, pre-check=0
Vary Accept-Encoding,User-Agent
Content-Encoding gzip
Content-Length 1167
Keep-Alive timeout=1, max=100
Connection Keep-Alive
Content-Type text/javascript; charset=utf-8


Request headers


Host myurl.xx
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; pl; rv:1.9.2.4) Gecko/20100611 Firefox/3.6.4 ( .NET CLR 3.5.30729; .NET4.0E)
Accept application/json, text/javascript, */*
Accept-Language pl,en-us;q=0.7,en;q=0.3
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-2,utf-8;q=0.7,*;q=0.7
Keep-Alive 115
Connection keep-alive
Origin null

I've changed the url to : myrul.xx but I use valid url.

What can be a possible reason for that result ?

for example I've tryed that (I don't use any query strings) :

 $.getJSON('http://mysite.com', function (jd) {
   $.each(jd, function (index, value) {
       $('#stage').append('<p>' + value.title + '</p>');
       $('#stage').append('<img src=\'' + value.picture + '\'></p>');
       $('#stage').append('<p><a href=\'' + value.url + '\'>url</a></p>');
       $('#stage').append('<hr/>');
   });
});
A: 

You need to add a callback in the url i.e Flickr have jsoncallback

http://api.flickr.com/services/feeds/photos_public.gne?tagmode=any&amp;format=json&amp;jsoncallback=?

Codler