title: How to get JavaScript variable in AJAX call as Laravel route name
body: <p>Hi I am using one AJAX function for 7 API sync calls so that I tried this code:</p>
  
  <pre><code>&lt;a href="javascript:void(0)" class="sync-commands" data-name="order-sync" &gt;Shopify Order Sync&lt;/a&gt;
  &lt;a href="javascript:void(0)" class="sync-commands" data-name="shopify.order.sync"&gt;Shopify Product&lt;/a&gt;
  </code></pre>
  
  <p>and in ajax call, I am using this code:</p>
  
  <pre><code>$('.sync-commands').on('click', function (e) {
      e.preventDefault();
      var route_name =$(this).attr("data-name");
  
      $.ajax({
          url: "{{route(route_name)}}",  //error line here no route/undefine variable etc
  </code></pre>
  
  <p>How can I access this variable in my URL?
  I just want to call only one ajax call of 10 calls for different routes.
  How can I do this?</p>