I want to send a Ajax post request but i get some issues with CSRF.
Here is my js code :
function sendAjaxRequest(index){
var token = $('meta[name=csrf_token]').attr('content')
$.ajaxSetup({ headers: { 'csrftoken' : token } });
$.ajax({
method: "POST",
data: '{"value":"10"}',
dataType: 'json',
url: "http://localhost/laravel/public/",
});
}
Here is my route from my laravel routes.php file :
Route::post('/','AjaxController@updateOrder'
);
Here is my console (jQuery issue) :
POST http://localhost/kaemo/public/ 500 (Internal Server Error)
Here is my network preview :
TokenMismatchException in VerifyCsrfToken.php line 67:
Any ideas ?