title: Ajax passing Null to controller
body: <p>I tried to create Incident chart which can change the periods (Last 7 days/Last 30 days/Last 90 days). <br>However, I tried to pass it via ajax data to controller, but I got NULL value there.<br> How can I solve it? Below is my code.</p>
  <p>Blade:</p>
  <pre><code>&lt;div id=&quot;periods&quot; class=&quot;btn-group float-right&quot;&gt;
                          &lt;button class=&quot;btn dropdown-toggle p-0&quot; type=&quot;button&quot; data-toggle=&quot;dropdown&quot; aria-haspopup=&quot;true&quot; aria-expanded=&quot;false&quot;&gt;
                            Periods
                          &lt;/button&gt;
                          &lt;div class=&quot;dropdown-menu dropdown-menu-right&quot; id=&quot;periods-select&quot;&gt;
                            &lt;a class=&quot;dropdown-item&quot; href=&quot;#&quot;&gt;Last 7 days&lt;/a&gt;
                            &lt;a class=&quot;dropdown-item&quot; href=&quot;#&quot;&gt;Last 30 days&lt;/a&gt;
                            &lt;a class=&quot;dropdown-item&quot; href=&quot;#&quot;&gt;Last 90 days&lt;/a&gt;
                          &lt;/div&gt;
                        &lt;/div&gt;
  </code></pre>
  <p>JS file</p>
  <pre><code>  $(&quot;#periods&quot;).on('click', '.dropdown-item', function(e) {
      // e.preventDefault();
  
      var text = $(this).text();
      var periodTime = text.replace(/\D/g, &quot;&quot;) - 1;
  
      $.ajax({
        method: &quot;get&quot;,
        url: &quot;/&quot;,
        data: {
          id: periodTime
        },
        success: function(response) {
          alert(response);
        }
      });
      
    });
  </code></pre>
  <p>Controller</p>
  <pre><code>   public function index(Request $request) 
     {
  
    
              $length = $request-&gt;id;
              dd($length); &lt;== NULL value.
  .....
  
          return view('dashboard.homepage', compact('chartDataByDay'))-&gt;render();
     }
  </code></pre>
  <p>webp</p>
  <pre><code>    Route::get('/', 'DashboardController@index')-&gt;name('dashboard.homepage');
  </code></pre>