Accessing settings.jqXHR in ajax.data function
Accessing settings.jqXHR in ajax.data function
I stumbled upon a problem when trying to access settings.jqXHR in my ajax.data function and it is driving me crazy.
I just want to access the jqXHR object that should be in the settings object but if I try to access it, it is NULL. That wouldn't be so strange if console.log(settings) wouldn't clearly show that the settings object contains a jqXHR.object.
What am I missing?
[code]
$('#table').DataTable({
"ajax": {
"data": function(args, settings) {
console.log(settings); // -> Settings object containing a jqXHR-object
console.log(settings.jqXHR); // -> NULL
}
}
});
[/code]
Answers
settings.jqXHR
is set after theajax.data
function has been executed I'm afraid. UsepreXhr
if you need to access the raw jQuery object - however, I would suggest being very careful about using the settings object at all. It is considered to be private. It can, will and does change between versions.Allan