title: Laravel how to properly do an ajax call
body: <p>I have a simple button who throw this Ajax request :</p>
  
  <pre><code>function myfunction(param){
          var date_debut = $('#datet_debut').val();
          var date_fin = $('#date_fin').val();
          $.ajax({
              url: '{{ route('createDispo') }}',
              type: 'POST',
              dataType: "json",
              data: {
                  date_debut: name,
                  date_fin: name,
              },
  
              success: function (data) {
                  alert('success');
              },
              error: function (e) {
                  console.log(e.responseText);
              }
          });
      }
  </code></pre>
  
  <p>But I have this error :</p>
  
  <p>Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No message</p>
  
  <p>The route is generated like that :</p>
  
  <pre><code>Route::post('/createDispo','DepotDispoController@createDispo')-&gt;name('createDispo');
  </code></pre>
  
  <p>Here is the controller to handle the request :</p>
  
  <pre><code>public function createDispo(Request $request){
      $user = User::find($request-&gt;user_id);
      $disponibilite = new Disponibilite();
      $disponibilite-&gt;date_debut = $request-&gt;date_debut;
      $disponibilite-&gt;date_fin = $request-&gt;date_fin;
      $user-&gt;disponibilites()-&gt;save($disponibilite);
  }
  </code></pre>
  
  <p>So, why my Ajax request doesn't work ?</p>