title: Ajax GET request fails in laravel 8
body: <p>when i try to send a GET request with tutorial ,but its not working and end up with 500 internal server error
  I cant find any error by searching on forum or stackoverflow,and also i ma beginner, kindly seek your help</p>
  <p>here is my view ajax.blade.php</p>
  <pre><code>&lt;html&gt;
     &lt;head&gt;
        &lt;title&gt;Ajax Example&lt;/title&gt;
  
        &lt;script src = &quot;https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js&quot;&gt;
        &lt;/script&gt;
  
        &lt;script&gt;
        $.ajax({
           type: &quot;GET&quot;,
           url: &quot;getmsg&quot;,
           success: function(data) {
               console.log(data);
           },
           error: function(data){
               console.log(&quot;fail&quot;);
           }
          });
        &lt;/script&gt;
     &lt;/head&gt;
  
     &lt;body&gt;
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>here is the controller class</p>
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  
  class aController extends Controller
  {
      function index() {
        return response()-&gt;json(array('d'=&gt; 'success'));
      }
  }
  
  
  </code></pre>
  <p>here is web.php
  <code>Route::get('getmsg',[aController::class,'index']); </code></p>