I want to access a REST service on another domain. If, in JQuery, I specify:
dataType: \'json\'
it fails, as expected, since for cross-doma
AFAIK jQuery's implementation of JSONP uses a tag that is injected into the DOM (thus the restriction to the GET verb only) for which you cannot control the
Accept
request content type header. The src
of this script
tag is simply pointed to the remote domain url. It is the browser that simply fetches the underlying endpoint sending a regular GET request.
So if you want to be able to set request headers for cross domain calls you will have to setup a server side script on your domain that will delegate the call to the remote domain (and set the respective headers) and then send the AJAX request to your script.