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&timestamp=1339189838017 

b)

http://api.flickr.com/services/feeds/photos_public.gne?tags=red&format=json&timestamp=1339190039407 

question: why connection close? why working on localhost , not on actual domain?

looking @ http response headers of

http://flickr.com/services/rest/?method=flickr.photos.search&api_key=75564008a468bf8a284dc94bbd176dd8&tags=red&content_type=1&is_getty=true&text=red&format=json&timestamp=1339189838017

i 302 location

http://www.flickr.com/services/rest/?method=flickr.photos.search&api_key=75564008a468bf8a284dc94bbd176dd8&tags=red&content_type=1&is_getty=true&text=red&format=json&timestamp=1339189838017

so, flicker wants tell "use www.flicker.com instead of flicker.com!". url content.


Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -