Prototype + Flickr Ajax Request doesn't work w

2019-08-25 07:19发布

问题:

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