<script> var product_list = [ { pid: 6, igId: 5, brandId: 2, categoryId: 3, name: 'product 2' }, ]; var structuredData = { //groubyId: object 1: { name: 'PV Module', childDataList: { //groubyId: object 3: { name: 'Huawei', childDataList: [ { pid: 5, igId: 1, brandId: 3, categoryId: 3, name: 'product 1' }, { pid: 1, igId: 3, brandId: 4, categoryId: 3, name: 'product 4' }, ] }, 4: { name: 'Xiaomi', childDataList: [ { pid: 1, igId: 4, brandId: 1, categoryId: 3, name: 'product 3' }, ] }, }, }, 5: { name: 'Inverter', childDataList: [ { 2: { name: 'Lenovo', childDataList: [ { pid: 6, igId: 1, brandId: 2, categoryId: 3, name: 'product 2' } ] } } ] } } {% set ajaxRoutes='check_for_product_in_warehouse,select_data_ajax,get_document_hash,product_list_select_ajax,search_by_populate_query,sub_category_list_select_ajax,create_product_spec,'|split(',\n') %} console.log({{ ajaxRoutes|json_encode|raw }}) var ajaxRouteList = { {% for rts in ajaxRoutes %} {% if rts !='\n' and rts !='' %} {{ rts }}: '{{ url(rts) }}', {% endif %} {% endfor %} } function url_path(pathName) { if (typeof ajaxRouteList[pathName] !== 'undefined') return ajaxRouteList[pathName] else return '{{ url('dashboard') }}' }</script>