Ajax Laravel 419 POST Error


I would really be thankful if someone could help me with this. I am trying to make an Ajax call but I am getting 419 POST error.

My ajax call is something like

$(document).ready(function() {
    $("#company").click(function() {
            type: "POST",
            url : "/users",
            success : function (data) {

I am calling the blade template through my Route:

Route::post('/users', '[email protected]');
And Controller

public function loadContent()
        return view('listing.users')->render();
My company.blade.php is

    @foreach ($users as $user)
            <div class="posting-description">
            <h5 class="header"><a href="#"></a>{{$user->name}}
            <h5 class="header"> {{$user->streetaddress}} {{$company->postalcode}}</h5>  
            <p class="header">
             <span class="red-text"> <?= $service; ?>
             </span> is available on <span class="green-text">
             <?php echo $date; ?></span>

I am getting this error

POST 419 (unknown status)


Laravel 419 post error is usually related with api.php and token authorization

Make sure you pass the CSRF token with every AJAX request. That’s a token that Laravel automatically creates for each logged in user and it is used to verify you as an authenticated user.

Add this to your ajax call

    headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')

or you can exclude some URIs in VerifyCSRF token middleware

 protected $except = [

About the author