[-] FO : Apply changes from commit 1.4.X 1d0d59845b5f9cb9333a89e60523ab41df076d89 no cache for POST queries

This commit is contained in:
gRoussac
2013-01-23 15:48:15 +01:00
parent d886bf3103
commit 72c76e3b59
20 changed files with 144 additions and 69 deletions

View File

@@ -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: {

View File

@@ -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")');

View File

@@ -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: {

View File

@@ -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)
{

View File

@@ -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)
{

View File

@@ -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')
{

View File

@@ -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) {

View File

@@ -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
},

View File

@@ -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)

View File

@@ -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()

View File

@@ -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",

View File

@@ -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() {

View File

@@ -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",

View File

@@ -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',

View File

@@ -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);

View File

@@ -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',

View File

@@ -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() {

View File

@@ -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",

View File

@@ -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,

View File

@@ -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,