javascript - xhr response: connection closed -
i wrote flickr search engine makes call either public feed or flickrapi depending on selected drop down box. examples of jsonp function calls returned:
a) jsonflickrapi({"photos":{"page":1, "pages":201, "perpage":100, "total":"20042", "photo":[{"id":"5101738723"...
b) jsonflickrfeed({ "title": "recent uploads tagged red","link": "http://www.flickr.com/photos/tags/red/","description": "", ....
the strange thing is in local install (xampp
) both work fine , images when host exact same code on above domain jsonflickrapi
doesn't work. notice (by looking @ firebug) jsonflickrapi
response header says connection close
also, firebug doesn't show me response
tab when submit request jsonflickrapi
here code:
function makecall(uri) { xmlhttp = new xmlhttprequest(); xmlhttp.onreadystatechange = callback; xmlhttp.open("get", "jsonget.php?url="+uri, true); xmlhttp.send(); } function jsonflickrapi(response) { var data= response.photos.photo ; var output = ""; output += "<img src=http://farm" + data[4].farm + ".static.flickr.com/" + data[1].server + "/" + data[4].id + "_" + data[4].secret + ".jpg>"; document.getelementbyid("cell-0").innerhtml = output ; } //public feed function jsonflickrfeed(response) { var data= response.items[0].media.m ; alert(data); var output = ""; output += "<img src=" + data+ ">"; document.getelementbyid("cell-0").innerhtml = output ; } function callback() { //console.log("ready state: " + xmlhttp.readystate + "\nstatus" + xmlhttp.status); if(xmlhttp.readystate==4 && xmlhttp.status==200) { var jsonresponse = xmlhttp.responsetext; jsonresponse = eval(jsonresponse); } }
examples of calls:
a)
http://flickr.com/services/rest/?method=flickr.photos.search&api_key=75564008a468bf8a284dc94bbd176dd8&tags=red&content_type=1&is_getty=true&text=red&format=json×tamp=1339189838017
b)
http://api.flickr.com/services/feeds/photos_public.gne?tags=red&format=json×tamp=1339190039407
question: why connection close? why working on localhost , not on actual domain?
looking @ http response headers of
i 302 location
so, flicker wants tell "use www.flicker.com instead of flicker.com!". url content.
Comments
Post a Comment