我有一個jquery.ajax對象,我想在其中替換xhr。然而執行以下代碼給我一個錯誤:jQuery.ajax:TypeError:屬性'xhr'對象#<Object>不是函數
TypeError: Property 'xhr' of object #<Object> is not a function
相關的代碼是:
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();
}
});
阿賈克斯方法按名稱XHR無功能:REQ ..這是搞亂你的要求 –