我的LARAVEL 5脚本有一个问题。这是我的路线:
Route::get('cms/section/addCategory', 'Cms\SectionController@showCategory');
Route::post('cms/section/addCategory', 'Cms\SectionController@addCategory');
控制器:
// SHOW FORM WITH ADD CATEGORY
public function showCategory()
{
if (Sentinel::hasAnyAccess(['section.create']))
{
return view('cms.viewSystem.section.addCategory');
}
else
{
return view('cms.viewSystem.error');
}
}
// ADD NEW CATEGORY
public function addCategory()
{
return http_response_code(200);
}
Ajax脚本:
$(document).ready(function() {
$('form.ajax input[type=submit]').click(function(){
$.ajax({
type: 'POST',
utl: $('form.ajax').attr('action'),
data: new FormData($('form.ajax')[0]),
processData: false,
contentType: false
}).then(
function(error) {
console.log('good'+error);
},
function() {
console.log('bad');
}
);
event.preventDefault();
})
});
当我添加http_response_code脚本工作正常但当我更改500的值时,我在控制台中看到错误200的信息...你有什么想法吗?