Prototype + Flickr Ajax Request doesn't work with Firefox

末鹿安然 提交于 2020-01-25 09:16:08

问题


Hi every one I have a weird issue I been working with the Flickr API, in Flickr for make a connection with the server is through url format in my case something like this

http://api.flickr.com/services/rest/?method=flickr.photosets.getList&api_key=10cb3dccaa050efebdc01540c1d4d227&user_id=51390557@N07&format=json

If your run into any browser you are going to get a flickr function and is ok, but Im trying to obtain with Ajax of Prototype Im doing something like

    new Ajax.Request('http://api.flickr.com/services/rest/?method=flickr.photosets.getList&api_key=10cb3dccaa050efebdc01540c1d4d227&user_id=51390557@N07&format=json',
  {
    method:'get',
    onSuccess: function(transport){
        debugger;
      var response = transport.responseText || "no response text";
      alert("Success! \n\n" + response);
    },
    onFailure: function(){ alert('Something went wrong...') }
  });

And is working good in IE but in Firefox I dont know why Im getting in the responseText a blank string "". does any have any clue what am I doing wrong?

Thanks


回答1:


I guess the answer is because firefox don't accept crossdomain callings, so for this we can use JSONP the implementation for Prototype JS can found in: dandean.com/jsonp-for-prototypejs hope some body help this question and answer self question in the future =)

best Nahum



来源:https://stackoverflow.com/questions/3112399/prototype-flickr-ajax-request-doesnt-work-with-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!