Lumen ajax post

Solution:1

Also if someone would not send jQuery POST via form you can simply add to your script code below:

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

Remember to include this html inside your view:

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

Solution:2

I found the solution. Simply add the following code to the HTML form, allowing the user to be associated to the current form. This is described in the documentation.

VIEW :

<form id="form">
    <!-- Added the following line -->
    <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
    <div class="form-group">
        <input type="text"  class="form-control" name="test" placeholder="Test">
    </div>
    <button type="button" class="btn btn-primary btn-block valide">Submit</button>
</form>