我有这个AJAX方法,在这里我导入一个CSV文件,但我无法得到任何响应相同的代码在LINUX OS中执行每当我尝试在Windows中尝试它不工作意味着不发送响应
AJAX方法:
uploadUsers: function(data) {
return $.ajax({
url: "/api/importusers",
type: "POST",
data: data,
contentType: false,
cache: false,
processData: false,
})
}
AJAX代码:
$('#upload-users-frm').submit(function (e) {
e.preventDefault();
var data = new FormData(this)
app.uploadUsers(data).done(function (response) {
if ($.validateResponse(response)) {
if (response.status == true) {
if (response.message != '') {
Materialize.toast(response.message, 4000, '')
}
if (response.importError == true) {
$.showValidationMessage(response.ImportErrorMessage)
}
} else {
$.showValidationMessage(response.message)
}
}
})
})
表单代码:
<form id="upload-users-frm">
<div class="file-field input-field">
<div class="btn">
<span>Upload Users</span>
<input type="file" name="file" id="upload-user"
class="import-file" accept=".csv,
application/vnd.openxmlformats-o
fficedocument.spreadsheetml.sheet, application/vnd.ms-excel">
</div>
<div class="file-path-wrapper">
<input class="file-path validate import-file" type="text" >
</div>
</div>
</form>