Laravel Ajax 提交 404 错误
路由
Route::group(['prefix' => 'ajax', 'namespace' => 'Ajax'], function() {
Route::post('/mstore/morders', 'SitesController@morders');
});
public function morders(Request $request)
{
return true;
}
js 代码
$.ajax({
url : "{{ URL::to('/mstore/morders') }}",
type : "post",
traditional:true,
data:{"strorderid[]":strorderid,"strordernum[]":strordernum,"customname":customname,"customphone":customphone,"customaddress":customaddress},
dataType : "JSON",
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
success : function() {
alert("成功");
}
});
提交或者直接访问 http://yueyu-laravel:8888/mstore/morders 都是 404 错误,一晚上没招到问题,小白求指点,谢谢。
推荐文章: