title: How to add a variable in ajax URL route
body: <p>I am trying to concatenate a variable to my url link in ajax. The variable <code>$news</code> is the one that handles the notification id.</p>
  
  <pre><code>$(document).on("click", "#viewList", function() {
  
      $.ajaxSetup({
          headers: {
          'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
          }
      });
      var $news = $(this).prop("value");
      $.ajax({
          type: "get",
          url : '{{url("admin/recipients/", $news)}}', //returning an error undefined variable news
          data: {newsID : $news},
          success: function(store) {
              console.log(store);
              $('#rec').text(store);
          },
          error: function() {
            $('.alert').html('Error occured. Please try again.');
          }
      });
  
  });
  </code></pre>
  
  <p>In my web.php, it's route is inside a route group.</p>
  
  <pre><code>Route::group(['middleware' =&gt; 'auth:admin'], function () {
      Route::prefix('admin')-&gt;group(function() {
          Route::get('/recipients/{news}', 'Admin\NewsController@recipients');
      });
  });
  </code></pre>
  
  <p>So how can I make this work? By the way, my ajax is inside a <code>blade.php</code> file. </p>