I have a jquery.ajax object in which I want to substitute xhr. However executing the following code gives me an error:
TypeError: Property 'xhr' of object #<Object> is not a function
The relevant code is:
var req = jQuery.ajaxSettings.xhr();
req.upload.addEventListener('progress', calendar.check_progress, false);
$.ajax({
url: script_root + '_save_file/'+id+'/'+timestamp,
type: 'POST',
processData: false,
contentType: false,
data: fd,
xhr: req,
success: function(data){
do_something();
},
error: function(data){
console.log(data);
do_something_else();
}
});