Unable to send data using JSONP in Cross Domain

We have a scenario in which we need to send data from our domain (x.com) to another domain (y.com). The action on y.com is assigned HTTPPostand can be changed. But when sending data to y.com using AJAXand JSONPwith, the HTTPMethod POSTrequest is automatically converted to HTTPMethod GET.

+4
source share
3 answers

You cannot use POST with JSONP (look here and here ) because it just doesn’t work that way - it creates an element <script>to retrieve data that must be executed using a GET request. The JSONP solution does not use an object XmlHttpRequest, so it is not an AJAX request standard, but the content is still available dynamically - no difference to the end user.

JSONP can indeed be used to overcome the same origin policy , but as an alternative, you can use CORS , implemented in modern browsers, alternative to JSON with Padding.

+4

JSONP GET POST. , " ".

0

, , CrossDomain postMessage, HTML5. , , iframes, , - iframe, 1x1px : none css property. .

0