jsonp 跨站原則上僅能以「get」模式傳遞資料

From: http://stackoverflow.com/questions/2699277/post-data-to-jsonp

不可能用一個非同步的「post」模式,在一個跨網域的服務上,由於原則上的限定。所以僅能以「get」模式傳資料到跨網域服務。

範例網頁:http://xyz.cinc.biz/2013/02/jquery-jsonp.html

It is not possible to do an asynchronous POST to a service on another domain, due to the (quite sensible) limitation of the same origin policy. JSON-P only works because you’re allowed to insert<script> tags into the DOM, and they can point anywhere.

You can, of course, make a page on another domain the action of a regular form POST.

Edit: There are some interesting hacks out there if you’re willing to go to a lot of effort inserting hidden<iframe>s and mucking about with their properties.

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 變更 )

Twitter picture

You are commenting using your Twitter account. Log Out / 變更 )

Facebook照片

You are commenting using your Facebook account. Log Out / 變更 )

Google+ photo

You are commenting using your Google+ account. Log Out / 變更 )

連結到 %s