Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

radha's avatar
Level 1

419 unknown status ajax

Hi i want to send my form data to my controller page through ajax, But am getting "419 unknown status" error am not post my data. can anyone help me

This is my ajax calling, $.ajax({ url: '/invoices', method: 'POST', data: invoices, contentType: 'application/json', success: function(result) { alert("success"); }, error: function(error) { alert("Error in submitting data"); } });

and this is my web: Route::post('/invoices','InvoiceController@postInvoice');

Thank you..

0 likes
4 replies
Helmchen's avatar

did you include the csrf token?

<head> section of your layout

<meta name="csrf-token" content="{{ csrf_token() }}">

javascript

$.ajaxSetup({
  headers: {
    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  }
});
radha's avatar
Level 1

Yaa included csrf token. But still am facing the issue

Helmchen's avatar

what is the response from server in your developer console? besides the 419 status

radha's avatar
Level 1

Am getting method not allowed exception "Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException"

Please or to participate in this conversation.