diff --git a/admin-dev/themes/default/template/controllers/cart_rules/form.js b/admin-dev/themes/default/template/controllers/cart_rules/form.js index d679cbf6c..bad35e93d 100644 --- a/admin-dev/themes/default/template/controllers/cart_rules/form.js +++ b/admin-dev/themes/default/template/controllers/cart_rules/form.js @@ -338,7 +338,8 @@ function searchProducts() $.ajax({ type: 'POST', - url: 'ajax-tab.php', + headers: { "cache-control": "no-cache" }, + url: 'ajax-tab.php' + '?rand=' + new Date().getTime(), async: true, dataType: 'json', data: { diff --git a/js/admin-dnd.js b/js/admin-dnd.js index 1b614be71..1c26e4414 100644 --- a/js/admin-dnd.js +++ b/js/admin-dnd.js @@ -27,6 +27,16 @@ $(document).ready(function() { initTableDnD(); }); +function objToString(obj) { + var str = ''; + for (var p in obj) { + if (obj.hasOwnProperty(p)) { + str += p + '=' + obj[p] + '&'; + } + } + return str; +} + function initTableDnD(table) { if (typeof(table) == 'undefined') @@ -119,9 +129,10 @@ function initTableDnD(table) $.ajax({ type: 'POST', + headers: { "cache-control": "no-cache" }, async: false, - url: currentIndex + '&token=' + token + '&' + $.tableDnD.serialize(), - data: params, + url: currentIndex + '&token=' + token + '&' + 'rand=' + new Date().getTime(), + data: $.tableDnD.serialize() + '&' + objToString(params) , success: function(data) { var nodrag_lines = $(tableDrag).find('tr:not(".nodrag")'); diff --git a/js/login.js b/js/login.js index 4b81280ed..934e44261 100644 --- a/js/login.js +++ b/js/login.js @@ -61,7 +61,8 @@ function doAjaxLogin(redirect) { $('#login_form .ajax-loader').fadeIn('slow', function() { $.ajax({ type: "POST", - url: "ajax-tab.php", + headers: { "cache-control": "no-cache" }, + url: "ajax-tab.php" + '?rand=' + new Date().getTime(), async: true, dataType: "json", data: { @@ -92,7 +93,8 @@ function doAjaxForgot() { $('#forgot_password_form .ajax-loader').fadeIn('slow', function() { $.ajax({ type: "POST", - url: "ajax-tab.php", + headers: { "cache-control": "no-cache" }, + url: "ajax-tab.php" + '?rand=' + new Date().getTime(), async: true, dataType: "json", data: { diff --git a/js/productTabsManager.js b/js/productTabsManager.js index 045d80e33..cb3ac4e13 100644 --- a/js/productTabsManager.js +++ b/js/productTabsManager.js @@ -117,10 +117,11 @@ function ProductTabsManager(){ } return $.ajax({ - url : $('#link-'+tab_name).attr("href")+"&ajax=1", + url : $('#link-'+tab_name).attr("href")+"&ajax=1" + '&rand=' + new Date().getTime(), async : true, cache: false, // cache needs to be set to false or IE will cache the page with outdated product values type: 'POST', + headers: { "cache-control": "no-cache" }, data: data, success : function(data) { diff --git a/js/tools.js b/js/tools.js index 6a9afb890..305b87941 100644 --- a/js/tools.js +++ b/js/tools.js @@ -263,7 +263,8 @@ function setCurrency(id_currency) { $.ajax({ type: 'POST', - url: baseDir + 'index.php', + headers: { "cache-control": "no-cache" }, + url: baseDir + 'index.php' + '?rand=' + new Date().getTime(), data: 'controller=change-currency&id_currency='+ parseInt(id_currency), success: function(msg) { diff --git a/modules/blockcart/ajax-cart.js b/modules/blockcart/ajax-cart.js index 710841a48..6bcbc5732 100644 --- a/modules/blockcart/ajax-cart.js +++ b/modules/blockcart/ajax-cart.js @@ -110,10 +110,12 @@ var ajaxCart = { // save the expand statut in the user cookie $.ajax({ - type: 'GET', - url: baseDir + 'modules/blockcart/blockcart-set-collapse.php', + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: baseDir + 'modules/blockcart/blockcart-set-collapse.php' + '?rand=' + new Date().getTime(), async: true, - data: 'ajax_blockcart_display=expand' + '&rand=' + new Date().getTime() + cache: false, + data: 'ajax_blockcart_display=expand' }); @@ -122,8 +124,9 @@ var ajaxCart = { // Fix display when using back and previous browsers buttons refresh : function(){ $.ajax({ - type: 'GET', - url: baseUri, + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: baseUri + '?rand=' + new Date().getTime(), async: true, cache: false, dataType : "json", @@ -152,9 +155,11 @@ var ajaxCart = { // save the expand statut in the user cookie $.ajax({ - type: 'GET', - url: baseDir + 'modules/blockcart/blockcart-set-collapse.php', + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: baseDir + 'modules/blockcart/blockcart-set-collapse.php' + '?rand=' + new Date().getTime(), async: true, + cache: false, data: 'ajax_blockcart_display=collapse' + '&rand=' + new Date().getTime() }); } @@ -194,7 +199,8 @@ var ajaxCart = { //send the ajax request to the server $.ajax({ type: 'POST', - url: baseUri, + headers: { "cache-control": "no-cache" }, + url: baseUri + '?rand=' + new Date().getTime(), async: true, cache: false, dataType : "json", @@ -251,7 +257,8 @@ var ajaxCart = { //send the ajax request to the server $.ajax({ type: 'POST', - url: baseUri, + headers: { "cache-control": "no-cache" }, + url: baseUri + '?rand=' + new Date().getTime(), async: true, cache: false, dataType : "json", @@ -698,7 +705,13 @@ $(document).ready(function(){ ); $('.delete_voucher').live('click', function() { - $.ajax({url:$(this).attr('href')}); + $.ajax({ + type: 'POST', + headers: { "cache-control": "no-cache" }, + async: true, + cache: false, + url:$(this).attr('href') + '?rand=' + new Date().getTime() + }); $(this).parent().parent().remove(); if ($('body').attr('id') == 'order' || $('body').attr('id') == 'order-opc') { diff --git a/modules/carriercompare/carriercompare.js b/modules/carriercompare/carriercompare.js index d3104431c..00f012db9 100644 --- a/modules/carriercompare/carriercompare.js +++ b/modules/carriercompare/carriercompare.js @@ -49,7 +49,8 @@ function updateStateByIdCountry() var query = $.ajax({ type: 'POST', - url: baseDir + 'modules/carriercompare/ajax.php', + headers: { "cache-control": "no-cache" }, + url: baseDir + 'modules/carriercompare/ajax.php' + '?rand=' + new Date().getTime(), data: 'method=getStates&id_country=' + $('#id_country').val(), dataType: 'json', success: function(json) { @@ -78,7 +79,8 @@ function updateCarriersList() var query = $.ajax({ type: 'POST', - url: baseDir + 'modules/carriercompare/ajax.php', + headers: { "cache-control": "no-cache" }, + url: baseDir + 'modules/carriercompare/ajax.php' + '?rand=' + new Date().getTime(), data: 'method=getCarriers&id_country=' + $('#id_country').val() + '&id_state=' + $('#id_state').val() + '&zipcode=' + $('#zipcode').val(), dataType: 'json', success: function(json) { @@ -129,7 +131,8 @@ function saveSelection() var query = $.ajax({ type: 'POST', - url: baseDir + 'modules/carriercompare/ajax.php', + headers: { "cache-control": "no-cache" }, + url: baseDir + 'modules/carriercompare/ajax.php' + '?rand=' + new Date().getTime(), data: 'method=saveSelection&' + $('#compare_shipping_form').serialize(), dataType: 'json', success: function(json) { diff --git a/modules/favoriteproducts/favoriteproducts.js b/modules/favoriteproducts/favoriteproducts.js index cc6e731d9..4aa058ec1 100755 --- a/modules/favoriteproducts/favoriteproducts.js +++ b/modules/favoriteproducts/favoriteproducts.js @@ -1,8 +1,9 @@ $('document').ready(function(){ $('#favoriteproducts_block_extra_add').click(function(){ $.ajax({ - url: favorite_products_url_add, + url: favorite_products_url_add + '?rand=' + new Date().getTime(), type: "POST", + headers: { "cache-control": "no-cache" }, data: { "id_product": favorite_products_id_product }, @@ -19,8 +20,9 @@ $('document').ready(function(){ }); $('#favoriteproducts_block_extra_remove').click(function(){ $.ajax({ - url: favorite_products_url_remove, + url: favorite_products_url_remove + '?rand=' + new Date().getTime(), type: "POST", + headers: { "cache-control": "no-cache" }, data: { "id_product": favorite_products_id_product }, @@ -37,8 +39,9 @@ $('document').ready(function(){ }); $('#favoriteproducts_block_extra_added').click(function(){ $.ajax({ - url: favorite_products_url_remove, + url: favorite_products_url_remove + '?rand=' + new Date().getTime(), type: "POST", + headers: { "cache-control": "no-cache" }, data: { "id_product": favorite_products_id_product }, @@ -55,8 +58,9 @@ $('document').ready(function(){ }); $('#favoriteproducts_block_extra_removed').click(function(){ $.ajax({ - url: favorite_products_url_add, + url: favorite_products_url_add + '?rand=' + new Date().getTime(), type: "POST", + headers: { "cache-control": "no-cache" }, data: { "id_product": favorite_products_id_product }, diff --git a/modules/productcomments/js/productcomments.js b/modules/productcomments/js/productcomments.js index 9bcc784ec..aa9ac386b 100644 --- a/modules/productcomments/js/productcomments.js +++ b/modules/productcomments/js/productcomments.js @@ -12,13 +12,14 @@ $(function() { var parent = $(this).parent(); $.ajax({ - url: productcomments_controller_url, + url: productcomments_controller_url + '?rand=' + new Date().getTime(), data: { id_product_comment: id_product_comment, action: 'comment_is_usefull', value: is_usefull }, type: 'POST', + headers: { "cache-control": "no-cache" }, success: function(result){ parent.fadeOut('slow', function() { parent.remove(); @@ -34,12 +35,13 @@ $(function() { var parent = $(this).parent(); $.ajax({ - url: productcomments_controller_url, + url: productcomments_controller_url + '?rand=' + new Date().getTime(), data: { id_product_comment: idProductComment, action: 'report_abuse' }, type: 'POST', + headers: { "cache-control": "no-cache" }, success: function(result){ parent.fadeOut('slow', function() { parent.remove(); @@ -57,9 +59,10 @@ $(function() { url_options = parseInt(productcomments_url_rewrite) ? '?' : '&'; $.ajax({ - url: productcomments_controller_url+url_options+'action=add_comment&secure_key='+secure_key, + url: productcomments_controller_url + url_options + 'action=add_comment&secure_key=' + secure_key + '&rand=' + new Date().getTime(), data: $('#fancybox-content form').serialize(), type: 'POST', + headers: { "cache-control": "no-cache" }, dataType: "json", success: function(data){ if (data.result) diff --git a/modules/statsgeolocation/statsgeolocation.js b/modules/statsgeolocation/statsgeolocation.js index 0abb52937..0e233e58f 100644 --- a/modules/statsgeolocation/statsgeolocation.js +++ b/modules/statsgeolocation/statsgeolocation.js @@ -37,8 +37,9 @@ function wait() function doAjax(dataform) { $.ajax({ - url: '../modules/statsgeolocation/config.php', + url: '../modules/statsgeolocation/config.php' + '?rand=' + new Date().getTime(), type: 'POST', + headers: { "cache-control": "no-cache" }, data: dataform, dataType: 'html', error: function() diff --git a/themes/default/js/cart-summary.js b/themes/default/js/cart-summary.js index e76f00a45..a798aed0d 100644 --- a/themes/default/js/cart-summary.js +++ b/themes/default/js/cart-summary.js @@ -86,8 +86,9 @@ function changeAddressDelivery(obj) if (new_id_address_delivery > 0) // Change the delivery address { $.ajax({ - type: 'GET', - url: baseUri, + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: baseUri + '?rand=' + new Date().getTime(), async: true, cache: false, dataType: 'json', @@ -158,8 +159,9 @@ function changeAddressDelivery(obj) }); $.ajax({ - type: 'GET', - url: baseUri, + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: baseUri + '?rand=' + new Date().getTime(), async: true, cache: false, dataType: 'json', @@ -270,8 +272,9 @@ function deleteProductFromSummary(id) if (typeof(ids[3]) !== 'undefined') id_address_delivery = parseInt(ids[3]); $.ajax({ - type: 'GET', - url: baseUri, + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: baseUri + '?rand=' + new Date().getTime(), async: true, cache: false, dataType: 'json', @@ -393,8 +396,9 @@ function upQuantity(id, qty) if (typeof(ids[3]) !== 'undefined') id_address_delivery = parseInt(ids[3]); $.ajax({ - type: 'GET', - url: baseUri, + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: baseUri + '?rand=' + new Date().getTime(), async: true, cache: false, dataType: 'json', @@ -473,8 +477,9 @@ function downQuantity(id, qty) if (newVal > 0 || $('#product_'+id+'_gift').length) { $.ajax({ - type: 'GET', - url: baseUri, + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: baseUri + '?rand=' + new Date().getTime(), async: true, cache: false, dataType: 'json', @@ -774,8 +779,9 @@ $(document).ready(function() { $('#allow_seperated_package').live('click', function() { $.ajax({ - type: 'GET', - url: baseUri, + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: baseUri + '?rand=' + new Date().getTime(), async: true, cache: false, data: 'controller=cart&ajax=true&allowSeperatedPackage&value=' @@ -815,7 +821,8 @@ function updateExtraCarrier(id_delivery_option, id_address) $.ajax({ type: 'POST', - url: url, + headers: { "cache-control": "no-cache" }, + url: url + '?rand=' + new Date().getTime(), async: true, cache: false, dataType : "json", diff --git a/themes/default/js/history.js b/themes/default/js/history.js index 709555495..f5bcc0e7e 100644 --- a/themes/default/js/history.js +++ b/themes/default/js/history.js @@ -108,7 +108,8 @@ function sendOrderMessage() $.ajax({ type: "POST", - url: $('#sendOrderMessage').attr("action"), + headers: { "cache-control": "no-cache" }, + url: $('#sendOrderMessage').attr("action") + '?rand=' + new Date().getTime(), data: paramString, success: function (msg){ $('#block-order-detail').fadeOut('slow', function() { diff --git a/themes/default/js/order-address.js b/themes/default/js/order-address.js index 64e7e1e9b..02dc962bd 100644 --- a/themes/default/js/order-address.js +++ b/themes/default/js/order-address.js @@ -102,7 +102,8 @@ function updateAddresses() var idAddress_invoice = $('input[type=checkbox]#addressesAreEquals:checked').length === 1 ? idAddress_delivery : $('#id_address_invoice').val(); $.ajax({ type: 'POST', - url: baseUri, + headers: { "cache-control": "no-cache" }, + url: baseUri + '?rand=' + new Date().getTime(), async: true, cache: false, dataType : "json", diff --git a/themes/default/js/order-opc.js b/themes/default/js/order-opc.js index 1a7d2c60f..a994f2eca 100644 --- a/themes/default/js/order-opc.js +++ b/themes/default/js/order-opc.js @@ -53,7 +53,8 @@ function updatePaymentMethodsDisplay() $('#opc_payment_methods-overlay').fadeIn('slow', function(){ $.ajax({ type: 'POST', - url: orderOpcUrl, + headers: { "cache-control": "no-cache" }, + url: orderOpcUrl + '?rand=' + new Date().getTime(), async: true, cache: false, dataType : "json", @@ -78,7 +79,8 @@ function updateAddressSelection() $.ajax({ type: 'POST', - url: orderOpcUrl, + headers: { "cache-control": "no-cache" }, + url: orderOpcUrl + '?rand=' + new Date().getTime(), async: true, cache: false, dataType : "json", @@ -164,7 +166,8 @@ function getCarrierListAndUpdate() $('#opc_delivery_methods-overlay').fadeIn('slow'); $.ajax({ type: 'POST', - url: orderOpcUrl, + headers: { "cache-control": "no-cache" }, + url: orderOpcUrl + '?rand=' + new Date().getTime(), async: true, cache: false, dataType : "json", @@ -213,7 +216,8 @@ function updateCarrierSelectionAndGift() $('#opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow'); $.ajax({ type: 'POST', - url: orderOpcUrl, + headers: { "cache-control": "no-cache" }, + url: orderOpcUrl + '?rand=' + new Date().getTime(), async: true, cache: false, dataType : "json", @@ -257,7 +261,8 @@ function confirmFreeOrder() $('#opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow'); $.ajax({ type: 'POST', - url: orderOpcUrl, + headers: { "cache-control": "no-cache" }, + url: orderOpcUrl + '?rand=' + new Date().getTime(), async: true, cache: false, dataType : "html", @@ -311,7 +316,8 @@ function saveAddress(type) $.ajax({ type: 'POST', - url: addressUrl, + headers: { "cache-control": "no-cache" }, + url: addressUrl + '?rand=' + new Date().getTime(), async: false, cache: false, dataType : "json", @@ -362,7 +368,8 @@ function updateNewAccountToAddressBlock() $('#opc_account-overlay, #opc_delivery_methods-overlay, #opc_payment_methods-overlay').fadeOut('slow');; $.ajax({ type: 'POST', - url: orderOpcUrl, + headers: { "cache-control": "no-cache" }, + url: orderOpcUrl + '?rand=' + new Date().getTime(), async: true, cache: false, dataType : "json", @@ -471,7 +478,8 @@ $(function() { $('#SubmitLogin').click(function() { $.ajax({ type: 'POST', - url: authenticationUrl, + headers: { "cache-control": "no-cache" }, + url: authenticationUrl + '?rand=' + new Date().getTime(), async: false, cache: false, dataType : "json", @@ -553,7 +561,8 @@ $(function() { $.ajax({ type: 'POST', - url: callingFile, + headers: { "cache-control": "no-cache" }, + url: callingFile + '?rand=' + new Date().getTime(), async: false, cache: false, dataType : "json", @@ -675,7 +684,8 @@ function bindInputs() $('#opc_delivery_methods-overlay').fadeIn('slow'); $.ajax({ type: 'POST', - url: orderOpcUrl, + headers: { "cache-control": "no-cache" }, + url: orderOpcUrl + '?rand=' + new Date().getTime(), async: false, cache: false, dataType : "json", @@ -753,7 +763,9 @@ function multishippingMode(it) { // Reload the cart $.ajax({ - url: orderOpcUrl, + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: orderOpcUrl + '?rand=' + new Date().getTime(), data: 'ajax=true&method=cartReload', dataType : 'html', cache: false, @@ -811,7 +823,9 @@ function multishippingMode(it) // Disable multi address shipping $.ajax({ - url: orderOpcUrl, + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: orderOpcUrl + '?rand=' + new Date().getTime(), async: true, cache: false, data: 'ajax=true&method=noMultiAddressDelivery' @@ -819,7 +833,9 @@ function multishippingMode(it) // Reload the cart $.ajax({ - url: orderOpcUrl, + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: orderOpcUrl + '?rand=' + new Date().getTime(), async: true, cache: false, data: 'ajax=true&method=cartReload', diff --git a/themes/default/js/products-comparison.js b/themes/default/js/products-comparison.js index ed79baeea..3a9118cff 100644 --- a/themes/default/js/products-comparison.js +++ b/themes/default/js/products-comparison.js @@ -35,9 +35,10 @@ reloadProductComparison = function() { $.ajax({ url: 'index.php?controller=products-comparison&ajax=1&action=remove&id_product=' + idProduct, async: false, + cache: false, success: function(){ - return true; -} + return true; + } }); }); @@ -51,12 +52,13 @@ reloadProductComparison = function() { $.ajax({ url: 'index.php?controller=products-comparison&ajax=1&action=add&id_product=' + idProduct, async: true, + cache: false, success: function(data){ if (data === '0') { checkbox.attr('checked', false); - alert(max_item); -} + alert(max_item); + } }, error: function(){ checkbox.attr('checked', false); @@ -68,6 +70,7 @@ reloadProductComparison = function() { $.ajax({ url: 'index.php?controller=products-comparison&ajax=1&action=remove&id_product=' + idProduct, async: true, + cache: false, success: function(data){ if (data === '0') checkbox.attr('checked', true); diff --git a/themes/default/mobile/js/cart.js b/themes/default/mobile/js/cart.js index c4d596919..01031afba 100644 --- a/themes/default/mobile/js/cart.js +++ b/themes/default/mobile/js/cart.js @@ -55,8 +55,9 @@ var CartUpd = (function() customizationId = 0; $.ajax({ - type: 'GET', - url: baseDir, + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: baseDir + '?rand=' + new Date().getTime(), async: true, cache: false, dataType: 'json', @@ -74,8 +75,9 @@ var CartUpd = (function() id_address_delivery = $("#cart_product_address_delivery_id_"+id).val(); customizationId = 0; $.ajax({ - type: 'GET', - url: baseDir, + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: baseDir + '?rand=' + new Date().getTime(), async: true, cache: false, dataType: 'json', diff --git a/themes/default/mobile/js/history.js b/themes/default/mobile/js/history.js index 7b885df6e..088deee0d 100644 --- a/themes/default/mobile/js/history.js +++ b/themes/default/mobile/js/history.js @@ -106,7 +106,8 @@ function sendOrderMessage () }); $.ajax({ type: "POST", - url: baseDir + "index.php?controller=order-detail", + headers: { "cache-control": "no-cache" }, + url: baseDir + "index.php?controller=order-detail" + '&rand=' + new Date().getTime(), data: paramString, success: function (msg){ $('#block-order-detail').fadeOut('slow', function() { diff --git a/themes/default/mobile/js/opc.js b/themes/default/mobile/js/opc.js index 6dc93fc7d..5baa99707 100644 --- a/themes/default/mobile/js/opc.js +++ b/themes/default/mobile/js/opc.js @@ -73,7 +73,8 @@ function initEvent() var checked = 0; $.ajax({ type: 'POST', - url: orderOpcUrl, + headers: { "cache-control": "no-cache" }, + url: orderOpcUrl + '?rand=' + new Date().getTime(), async: true, cache: false, dataType : "json", @@ -120,7 +121,8 @@ function updateCarrierSection(elm) $.ajax({ type: 'POST', - url: orderOpcUrl, + headers: { "cache-control": "no-cache" }, + url: orderOpcUrl + '?rand=' + new Date().getTime(), async: true, cache: false, dataType : "json", diff --git a/themes/default/mobile/js/product.js b/themes/default/mobile/js/product.js index e742f0b73..c9ebf08ad 100644 --- a/themes/default/mobile/js/product.js +++ b/themes/default/mobile/js/product.js @@ -219,7 +219,8 @@ var ProductFn = (function() $.ajax({ type: 'POST', - url: customAction, + headers: { "cache-control": "no-cache" }, + url: customAction + '?rand=' + new Date().getTime(), data: 'ajax=true&'+$('#customizationForm').serialize(), dataType: 'json', async : true, diff --git a/themes/default/mobile/js/stores.js b/themes/default/mobile/js/stores.js index 64120b704..0ce286663 100644 --- a/themes/default/mobile/js/stores.js +++ b/themes/default/mobile/js/stores.js @@ -66,7 +66,8 @@ function getStores(coordinates, radius) // ajax call $.ajax({ type: 'POST', - url: 'index.php?controller=stores', + headers: { "cache-control": "no-cache" }, + url: 'index.php?controller=stores' + '&rand=' + new Date().getTime(), data: 'ajax=true&latitude=' + latitude + '&longitude=' + longitude + '&radius=' + radius, dataType: 'json', async : true,