我試圖做一個POST到500內部服務器錯誤阿賈克斯Laravel
http://localhost:8888/test
JS
$('.saveBTN').click(function (event) {
$("form#editForm").on("submit", function(event) {
event.preventDefault();
var inputs = {};
$("#editForm :input").each(function() {
inputs[$(this).attr("name")] = $(this).val();
});
var $inputs = JSON.stringify(inputs);
$.ajax({
headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
url: '/test',
type: 'POST',
dataType: 'json',
data: $inputs,
success: function (data, textStatus, xhr) {
console.log(data);
},
error: function (xhr, textStatus, errorThrown) {
console.log('PUT error.');
}
});
});
我不斷收到
500內部服務器錯誤
我試過加
<meta name="csrf-token" value="{{ csrf_token() }}">
,這對我的Ajax
headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
在這個任何提示將非常感激!
火起來的檢查看看500響應,會給你到底是怎麼回事更好的主意的全部細節。猜測是路由你說你的錯誤處理PUT錯誤,但正在發出POST請求,你正在尋找你的路線上的PUT? –
你的路由是什麼樣的? – camelCase
你可以檢查存儲文件夾中的日誌文件是否存在錯誤堆棧? – Vikas