jQuery(document).ready(function () { // Sticky Header JS var newsIndex = []; for(var i=0, len=localStorage.length; i= 0){ newsIndex.push(key); } } for(var i = 0 ; i <= newsIndex.length; i ++){ localStorage.removeItem(newsIndex[i]); } jQuery('.ecommerce-shop-products-tab').on('click', 'li.ecommerce-shop-products-tabs-title', function(e) { e.preventDefault(); var select_category_id = jQuery( this ).attr( 'select_category_id' ); var tab_product_count = jQuery( this ).attr('tab_product_count'); var widget = jQuery(this).closest(".news_class"); var id = jQuery(widget).attr('id'); var storage_id = id + "-" +select_category_id; var data = localStorage.getItem(storage_id); var that = jQuery( this ); var buzz_ecommerce_ajaxtab_content = that.closest(".products-tab-wraper").find(".products-tab-section"); jQuery.ajax({ url : BuzzEcommerce.ajaxurl, type : 'post', data : { action : 'category_tab_products', post_id : select_category_id, prduct_count : tab_product_count, }, success : function( response ) { setTimeout(function() { localStorage.setItem(storage_id, data); jQuery(buzz_ecommerce_ajaxtab_content).html(response); }, 1000); }, beforeSend: function() { jQuery(buzz_ecommerce_ajaxtab_content).html('
'); }, }); }); });