表单位于页面public / config上,当我提交表单时,我想通过AJAX请求在同一页面(public / config)上的配置表中添加一个项目,但是当我点击提交按钮时,它显示了这个错误:
Error in exception handler: Route [login] not defined. in C:\wamp\www\betsmanage\vendor\laravel\framework\src\Illuminate\Routing\UrlGenerator.php:231
routes.php文件:
Route::get('config', 'ConfigController@showIndex');
Route::post('config', 'ConfigController@storeTipster');
形式:
<form action="config" method="POST" id="tipsterform-add" class="form-horizontal" role="form">
AJAX请求:
$('#tipsterform-add').submit(function(e){
e.preventDefault();
var $form = $(this);
$.post($form.attr('action'), $form.serialize))
.done(function(data, text, jqxhr){
$tr = $(jqxhr.responseText);
$('.tipsterstable').prepend($tr);
})
.fail(function(jqxhr){
alert(jqxhr.responseText);
})
});
我该怎么做?