title: Laravel: Send Data to Controller via AJAX Without Form
body: <p>I need to send data via JS to a Laravel controller on a button click. I'm not using any form because the data is being created dynamically. 
  Every time i try to send the data, i get an Internal Server Error (500), but unable to catch that exception in the controller or the laravel.log file.</p>
  
  <p>Here's what i'm doing:</p>
  
  <p>Route:</p>
  
  <pre><code>Route::post('section/saveContactItems', 'SectionController@saveContactItems');
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>public function saveContactItems($id, $type, $items, $languageID = "PT"){ ... }
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>$('button').on("click", function (evt) {
  
      evt.preventDefault();
  
      var items = [];
      var id = $("#id").val();
      var languageID = $("#languageID").val();
      var data = { id: id, type: type, items: JSON.stringify(items), languageID: languageID };
  
      $.ajax({
          url: "/section/saveContactItems",
          type: "POST",
          data: data,
          cache: false,
          contentType: 'application/json; charset=utf-8',
          processData: false,
          success: function (response)
          {
              console.log(response);
          }
      });
  });
  </code></pre>
  
  <p>What am i doing wrong? How can i accomplish this?</p>
  
  <p><strong>UPDATE: Thanks to @ShaktiPhartiyal's <a href="https://stackoverflow.com/a/43214377/1880662">answer</a> (and @Sanchit's help) i was able to solve my issue. In case some else comes into a similar problem, after following @Shakti's answer i wasn't able to access the data in the controller. So, i had to stringify the data before sending it to the server:</strong></p>
  
  <pre><code>data: JSON.stringify(data),
  </code></pre>