I have one problem with my script on LARAVEL 5. This is my route:
Route::get('cms/section/addCategory', 'Cms\SectionController@showCategory');
Route::post('cms/section/addCategory', 'Cms\SectionController@addCategory');
Controller:
// 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 Script:
$(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();
})
});
And when I add http_response_code script working good but when I change value for 500 I see in console still informations for error 200... Have you any ideas?