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 HTTPPost
and can be changed. But when sending data to y.com using AJAX
and JSONP
with, the HTTPMethod POST
request is automatically converted to HTTPMethod GET
.
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.