Hi I am using one AJAX function for 7 API sync calls so that I tried this code:
<a href="javascript:void(0)" class="sync-commands" data-name="order-sync" >Shopify Order Sync</a>
<a href="javascript:void(0)" class="sync-commands" data-name="shopify.order.sync">Shopify Product</a>
and in ajax call, I am using this 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
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?