我是jquery的新手,我得到400
錯誤的請求(我在瀏覽器控制檯中找到)。AJAX調用獲取「400錯誤請求」
$("form#upload").submit(function(){
var token = $("meta[name='_csrf']").attr("content");
var header = $("meta[name='_csrf_header']").attr("content");
var formData = new FormData($(this)[0]);
$.ajax({
url : '/uploadController/upload',
type: 'POST',
data: formData,
async: false,
beforeSend: beforeSendHandler,
success: function (data) {
var msg=data.msg;
var obj=data.obj;
if(data.success == true)
{
$('#successmsg').html(msg);
$('.alert-success').show();
$('.alert-danger').hide();
setTimeout(function() {
$(".alert-success").alert('close');
}, 10000);
}else {
$('#errmsg').html(msg);
$('.alert-danger').show();
$('.alert-success').hide();
setTimeout(function() {
$(".alert-danger").alert('close');
}, 10000);
}
},
cache: false,
contentType: false,
processData: false
});
return false;
});
POST url 400(Bad Request)
這裏控制檯錯誤$.ajax({
線出現在我的js文件。
但它在一些系統上工作,我不是什麼問題。
任何人有一些想法?非常感謝。
控制檯中顯示的錯誤是什麼? – doutriforce
錯誤的請求可能有很多事情,通常我發現它使用了錯誤的HTTP請求方法。 – George
最有可能是因爲網址不正確 – sTx