async function getDataStatAxios(url) { const config = { url, method: 'get', headers: { 'Authorization': `stat 05b2f2ca510344968c65e1ebf49a5595`, } }; let response = await axios(config); let item_array = JSON.parse(response.data.result); $.each(item_array, function (key, value) { let item_html = `
  • ${value.productname}
  • ${value.itemname}
  • ${value.sku}
Details
`; // $(".product_name").html(value.productname); $(".item_details").append(item_html); }) $(".item_details").find(".items_ptoducts").each(function(){ $(this).find(".card_body").find("a.btn").click(function(){ let product_id = $(this).find(".card-body").find("a.btn").attr("data_detail"); let loc_path = '/productdetails.html' if (window.location.pathname.includes(loc_path)) { window.location.href = `?itemid=${product_id}` } else { window.location.href = `/productdetails.html?itemid=${product_id}`; } }) }); } let port = SERVERNAME let loc_id = window.location.search; let loc_url = loc_id.split("="); let locpath = "/products.html?products"; let url; if (window.location.href.includes(locpath)) { url = `${port}/apis/v4/bizgaze/integrations/products/getallproducts`; }else{ url = `${port}/apis/v4/bizgaze/integrations/products/getproductsbyid/itemgroupid/${loc_url[1]}`; } getDataStatAxios(url); $("#item_search").on("keyup", function() { var value = $(this).val().toLowerCase(); $(".list_items").find(".items_ptoducts").filter(function() { $(this).toggle($(this).attr("data_item_search").toLowerCase().indexOf(value) > -1) }); });