【发布时间】:2026-01-10 03:20:04
【问题描述】:
我正在尝试通过 ajax 请求将数据发布到控制器。但它找不到路线,并在控制台中显示以下内容。
POST http://127.0.0.1:8000/addNotification_action 404 (Not Found)
这是我下面的 ajax 调用。
function editNotification(obj) {
// alert(obj.id);
var obj_id = obj.id;
var id = obj_id.split("_");
$.ajax({
url: "{{ url('addNotification_action') }}",
type: 'POST',
dataType: 'json',
data: {edit_notification_id: id[1]},
})
.done(function(result) {
console.log(result);
$('#title').val(result['title']);
$('#description_notification').val(result['details']);
$('#edit_flag_notification').val(result['notification_id']);
})
.fail(function() {
alert("error");
});
}
我只是想 dd() 我在控制器中收到的请求。请帮忙。谢谢
【问题讨论】:
-
您是否为该
/addNotification_actionurl 设置了路由?请发帖 -
显示您的路线代码
-
Route::post('admin/addNotification_action', ['uses' => 'AdminController@addNotification']);