title: Laravel ajax post, not getting response, error or db insert
body: <p>I'm trying to make a POST ajax call that will take a form input value, pass it, through a route, to the contoller which will call an insert function. I've set my route, my insert function, my controller and my blade with the ajax call, but when I fill the input and hit the submit button, there is no response or error in the console and no record inserted into the database.</p>
  
  <p>Maybe I'm totally overlooking something but is it clear what I'm missing or doing wrong here? Perhaps I should be debugging this differently as well?</p>
  
  <p>Route.php</p>
  
  <pre><code>Route::post('insertFruit', 'Controller@insertFruit');
  </code></pre>
  
  <p>controller.php</p>
  
  <pre><code>public function insertFruit(Request $request)
  {
  
      if ($request-&gt;ajax()) {
  
          $productComment = $request-&gt;productComment;
  
          $fruitService = new fruitService();
          $fruitService-&gt;insertListRecord($productComment);
      }
  }
  </code></pre>
  
  <p>fruitService.php</p>
  
  <pre><code>public function insertListRecord($productComment)
  {
      $link = DB::conn();
      $sql = "CALL fruit.fruitInsert(?, ?)";
  
      $exec = odbc_exec($link, $sql);
  
      $prep = odbc_prepare($link, $sql);
      if ($prep === false) {
          $error = odbc_errormsg($link);
          if (!empty($error)) {
              throw new \Exception($error);
          }
      }
  
      $exec = odbc_execute($prep, array($productComment));
      if ($exec === false) {
          $error = odbc_errormsg($link);
          if (!empty($error)) {
              throw new \Exception($error);
          }
      }
  }
  </code></pre>
  
  <p>blade.php</p>
  
  <pre><code>    &lt;form id="productForm" class="uk-form uk-width-1-1"&gt;
      &lt;div class="uk-grid"&gt;
          &lt;div class="uk-width-1-1"&gt;
              &lt;label class="uk-form-label" for=""&gt;Comments:&lt;/label&gt;
              &lt;textarea name="productComment" id="" cols="70" rows="5" placeholder="Optional"&gt;&lt;/textarea&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="uk-grid"&gt;
          &lt;div class="uk-width-1-1 uk-text-center"&gt;
              &lt;button id="save" class="uk-button uk-button-primary uk-button-large" style="padding:0 50px;"&gt;Save&lt;/button&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  
      $("#save").click(function(e){
  
      e.preventDefault();
  
      var productComment = $("input[name=productComment]").val();
  
      $.ajax({
          url:'/insertFruit',
          data:{
  
              productComment:productComment
          },
          "_token": "{{ csrf_token() }}",
          type:"POST",
          success:function(response){
              console.log(response);
          },
          error: function(jqxhr, status, exception) {
               alert('Exception:', exception);
           }
      });
  
  });
  </code></pre>