title: Ajax jquery.min.js:4 POST 500 (Internal Server Error) laravel 5
body: <p>I got this error from Ajax call ! it's get action from checkbox then send data by Ajax to controller method,</p>
  
  <pre><code>jquery.min.js:4 POST http://localhost:8000/listhotelregisration 500 (Internal Server Error)
  </code></pre>
  
  <p>Here's the code  html part:</p>
  
  <pre><code>    &lt;div style="display:block"&gt;
        &lt;div&gt;My hotel Lists&lt;/div&gt;
          @foreach($myLists as $key =&gt; $val)
              {{ $val['name'] }
              {!! Form::checkbox($val['name'], $val['id'].','.$value['id']) !!} &lt;br&gt;
          @endforeach
         &lt;/div&gt;
  </code></pre>
  
  <p>Ajax part:</p>
  
  <pre><code> $(function() {
                $("input[type='checkbox']").change(function() {
                 var smi  = $(this).val();
                     // alert(smi);
                 $.ajax({
                  url: 'listhotelregisration',
                  type: "post",
                  data: {'checko':smi},
                  success: function(data){
                    //alert(data);
                  }
                });  
  
     });
  </code></pre>
  
  <p>Route part:</p>
  
  <pre><code>Route::post('listhotelregisration', 'ListhotelController@create');
  </code></pre>
  
  <p>Controller part:</p>
  
  <pre><code>public function create(Request $request)
  {
      $listhotel = new listhotel;
      $data = $request-&gt;all();
      $dataPrim = explode(",", $data);
  
      $listhotel-&gt;id_list= $dataPrim[0];
      $listhotel-&gt;id_hotel= $dataPrim[1]; 
  
      $listhotel-&gt;save();
      $response = "ok";
      return response ()-&gt;json ($response);
  
  }
  </code></pre>