JQuery on Google JSON fails with Error 405?

余生长醉 提交于 2019-12-08 07:50:55

问题


I am not able to understand, how to do fetch JSON data from Google servers, the requests fails with 405 HTTP error (Method Not Allowed). But I can download the JSON file manually or using PHP on my web server using file_get_contents API. But I want client browsers to download the JSON data directly. There are some similar questions on SO, but I am still not able to understand how to do that.

Any ideas?

Edit: I want to download and display this json data in Firefox 3.5

https://www.google.com/reader/api/0/stream/contents/feed/https://stackoverflow.com/feeds/question/1783288

I can download the file by specify ?callback=? in the URL, but can't read the data then. I am open to any other method also, rather than just jquery but it has to be client side javascript.


回答1:


Looks like you can't make cross domain request in firefox, using ?callback=?, gets the data in the jquery but fails to return as it is not in the jsonp format.




回答2:


You probably need to look at jsonp:

http://www.insideria.com/2009/03/what-in-the-heck-is-jsonp-and.html

Sounds like a cross domain problem that you might be able to work out with jsonp.



来源:https://stackoverflow.com/questions/1783288/jquery-on-google-json-fails-with-error-405

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