').prop("outerHTML"));
});
$(divID).html('');
$(divID).html(output.join(''));
}else{
$('#categorySection').hide();
$('#categorySection').html('');
}
}
$.ajax({
type: "GET",
contentType: "application/json",
url: url,
async: true,
beforeSend :function(){
$("#productList").html('
');
},
success: function(data){
populateItems(data, '#productList');
}
});
populateSubcategories(categoryToSearch, '#subCategoryFilter');
$('#subCategoryFilter').show();
$(function(){
$(document).on('change', '#subCategoryFilter', function() {
filterProductListByCategory(this.value);
}).on('click', '.pagination li', function(e){
e.preventDefault();
if (!$(this).hasClass('ellipsis')){
var pageClicked = $(this).attr('data-page');
if (pageClicked == "prev"){
pageClicked = parseInt($('.pagination li.current').attr('data-page')) - 1;
}else if (pageClicked == "next"){
pageClicked = parseInt($('.pagination li.current').attr('data-page')) + 1;
}
changePage(parseInt(pageClicked));
}
}).on('change', '#rowsPerPageTop', function(){
localStorage.setItem("pagination", $('#rowsPerPageTop option:selected').val());
rowPerPageChange('rowsPerPageTop', 'rowsPerPageBottom', $('#rowsPerPageTop option:selected').val());
changePage(1);
}).on('change', '#rowsPerPageBottom', function(){
localStorage.setItem("pagination", $('#rowsPerPageBottom option:selected').val());
rowPerPageChange('rowsPerPageBottom', 'rowsPerPageTop', $('#rowsPerPageBottom option:selected').val());
changePage(1);
}).on('click', '.linkCategoryToProduct', function(){
var productName = $(this).text(),
productID = $(this).parent().parent().parent().find('.btn-quote').data('product-id'),
category = $('#categoryID').data('category-name'),
list = "Category page: " + productName;
dataLayerSelectContent(list, productName, productID, category);
});
});