Post data to JsonP

后端 未结 7 1331
傲寒
傲寒 2020-11-22 07:22

Is it possible to post data to JsonP? Or does all data have to be passed in the querystring as a GET request?

I have alot of data that I need to send to the service,

相关标签:
7条回答
  • 2020-11-22 08:29

    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.

    0 讨论(0)
提交回复
热议问题