Hi Dimitriy,
To get the options used by the xhr request (including the ContentType
header), use the this keyword in the callback function:
$.post(url, data, function(){
/* the content of this from a typical $.post operation
this[type]=POST
this[url]=url
this[data]=data
this[success]=[callback function]
this[dataType]=undefined
this[global]=true
this[timeout]=0
this[contentType]=application/x-www-form-urlencoded
this[processData]=true
this[async]=true
this[username]=null
this[password]=null
this[accepts]=[object]
*/
var ContentTypeHeader = this.contentType;
})
on 13/07/2009 11:38 dnagir said::
Hi Rob,
But I don't see where I can get the XMLHttpRequest objects.
Only one thing related to XHR is this.xhr() function. And it returns a
new XHR object, so obviously it has no headers.
What am I missing?
Cheers,
Dmitriy.
How can I check the ContentType header in the $.post callback?
Try the W3C XMLHttpRequest Object specification:
<URL:http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060405/#dfn-getresponse...