for XMLHttpRequest it is pretty easy:
var xhr = new XMLHttpRequest();
xhr.open('POST', MyUrl, true);
xhr.setRequestHeader('Content-Type', 'application/json')
But how do I achieve this for XDomainRequest?
for XMLHttpRequest it is pretty easy:
var xhr = new XMLHttpRequest();
xhr.open('POST', MyUrl, true);
xhr.setRequestHeader('Content-Type', 'application/json')
But how do I achieve this for XDomainRequest?
It's not possible to override the XMLHttpRequest content-type. You should set it correctly on the server e.g. for php:
header('Content-type: application/json');
If this is not possible, then you can create a local proxy script which mirrors your crossdomain script with the correct header