Reputation: 2018
This was a great help to describing what is and how to make jsonp requests. https://stackoverflow.com/a/6879319/371137
I, however, also need to change the Accept value in the request header to 'application/javascript' so my 3rd party server will respond correctly.
There are lots of SO answers pertaining to setting the header values (including Pass accepts header parameter to jquery ajax) w/ the API, but none seem to be in conjunction with "jsonp".
I can't seem to figure out from jQuery's documentation how to actually alter the Accept header value when using datatype "jsonp".
beforeSend does nothing. "accepts" does nothing. "headers" seems to be ignored.
I can't even seem to set any custom headers at all.
No matter what i do the Accept header value is always '/'.
Any help would be appreciated.
Upvotes: 1
Views: 811
Reputation: 171669
No. JSONP requests are actually script requests(why the json is wrapped in function) which don't allow headers to be added
Similarly they can't be use for methods like POST
Upvotes: 2