title: Laravel 5 AJAX 500 Error on Post
body: <p>I am trying to follow this tutorial for Laravel 5 and AJAX <a href="https://www.youtube.com/watch?v=PRCm-7mEDkY" rel="nofollow">https://www.youtube.com/watch?v=PRCm-7mEDkY</a> which obviously works, but am getting a 500 Internal Server Error on the Post Request. What am I doing wrong? I just want to understand a simple example and work up from there.</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;a href="#" id="get"&gt;Get&lt;/a&gt;
  &lt;hr&gt;
  &lt;form action="#"&gt;
      &lt;input type="text" name="name"&gt;
      &lt;button type="submit"&gt;Send&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>JS</p>
  
  <pre><code>$(function() {
      $('#get').click(function(e){
  
          e.preventDefault();
  
          $.get('categories', function(data) {
              console.log(data);
          });
      });
  
      $('form').submit(function(e) {
          e.preventDefault();
  
          $.post('categories', {name:'name anything'}, function(data) {
              console.log(data);
          });
      });
  
  });
  </code></pre>
  
  <p>Route</p>
  
  <pre><code>Route::post('/categories', function() {
      if(Request::ajax() ) {
          var_dump(Input::all());
          return 'ajax post request';
      }
  });
  </code></pre>
  
  <p>Storage Logs</p>
  
  <pre><code>#0 /Users/neil/Sites/demo02/app/Http/Middleware/VerifyCsrfToken.php(17): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken-&gt;handle(Object(Illuminate\Http\Request), Object(Closure))
  #1 /Users/neil/Sites/demo02/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(125): App\Http\Middleware\VerifyCsrfToken-&gt;handle(Object(Illuminate\Http\Request), Object(Closure))
  #2 /Users/neil/Sites/demo02/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(55): Illuminate\Pipeline\Pipeline-&gt;Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
  #3 /Users/neil/Sites/demo02/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(125): Illuminate\View\Middleware\ShareErrorsFromSession-&gt;handle(Object(Illuminate\Http\Request), Object(Closure))
  #4 /Users/neil/Sites/demo02/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(61): Illuminate\Pipeline\Pipeline-&gt;Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
  #5 /Users/neil/Sites/demo02/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(125): Illuminate\Session\Middleware\StartSession-&gt;handle(Object(Illuminate\Http\Request), Object(Closure))
  #6 /Users/neil/Sites/demo02/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(36): Illuminate\Pipeline\Pipeline-&gt;Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
  #7 /Users/neil/Sites/demo02/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(125): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse-&gt;handle(Object(Illuminate\Http\Request), Object(Closure))
  #8 /Users/neil/Sites/demo02/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(40): Illuminate\Pipeline\Pipeline-&gt;Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
  #9 /Users/neil/Sites/demo02/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(125): Illuminate\Cookie\Middleware\EncryptCookies-&gt;handle(Object(Illuminate\Http\Request), Object(Closure))
  #10 /Users/neil/Sites/demo02/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(42): Illuminate\Pipeline\Pipeline-&gt;Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
  #11 /Users/neil/Sites/demo02/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(125): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode-&gt;handle(Object(Illuminate\Http\Request), Object(Closure))
  #12 [internal function]: Illuminate\Pipeline\Pipeline-&gt;Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
  #13 /Users/neil/Sites/demo02/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(101): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
  #14 /Users/neil/Sites/demo02/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(111): Illuminate\Pipeline\Pipeline-&gt;then(Object(Closure))
  #15 /Users/neil/Sites/demo02/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(84): Illuminate\Foundation\Http\Kernel-&gt;sendRequestThroughRouter(Object(Illuminate\Http\Request))
  #16 /Users/neil/Sites/demo02/public/index.php(53): Illuminate\Foundation\Http\Kernel-&gt;handle(Object(Illuminate\Http\Request))
  #17 /Users/neil/Sites/demo02/server.php(21): require_once('/Users/neil...')
  #18 {main}
  </code></pre>