10% OFF RIDING TOPS. CODE TOP10. SHOP NOW >
View Basket   0 items   £0.00
Checkout

Compare Products

'); return true; }; function save_into_array(data) { compare_html.push(data); console.log('Calling function: prepend_item with and ' + compare_html) return true; } function get_products_to_compare() { var products_to_compare = $.cookie('products_to_compare'); var product_to_compare = products_to_compare.split(/,/); return product_to_compare; } function get_ajax_information_on_product(the_ajax_url){ return $.ajax({ url: the_ajax_url, type: "GET", dataType: "json", success: function(data){ //save_into_array(i,data) } }); } $(document).ready(function(){ $('.location-back').click(function(){ window.history.back(); return false; }) $(document).delegate('.remove-compare', 'click', function(){ remove_product($(this)); return false; }); var product_to_compare = get_products_to_compare(); console.log('Products to compare are: ' + product_to_compare) $.each( product_to_compare, function( index, value ){ var the_ajax_url = '/products/'+value+'.js'; console.log('Calling function: get_ajax_information_on_product with: ' + the_ajax_url) get_ajax_information_on_product(the_ajax_url).done(function(result) { if (result) { save_into_array(result) prepend_item(result); } }) .fail(function(x) { $('#compare-products-item-list').hide().append('

Please choose some products to compare

').fadeIn('fast'); }); }); });

Refine