JQuery on Google JSON fails with Error 405?

2019-06-01 18:22发布

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.

2条回答
Evening l夕情丶
2楼-- · 2019-06-01 18:44

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.

查看更多
祖国的老花朵
3楼-- · 2019-06-01 18:47

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.

查看更多
登录 后发表回答