原型+ Flickr Ajax 请求不适用于 Firefox
大家好,我有一个奇怪的问题,我一直在使用 Flickr API,在 Flickr 中与服务器建立连接是通过 url 格式在我的例子中是这样的
如果您遇到任何浏览器,您将获得 flickr 功能并且没问题,但我尝试使用 Ajax 获取原型我做了类似
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 的事情,在 IE 中运行良好,但在 Firefox 中我不知道为什么我在responseText中得到一个空白字符串“”。有人知道我做错了什么吗?
谢谢
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
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想答案是因为 firefox 不接受跨域调用,所以为此我们可以使用 JSONP,Prototype JS 的实现可以在以下位置找到:dandean.com/jsonp-for-prototypejs 希望有人帮助这个问题并回答自我问题未来 =)
最好的
那厄姆
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