FIX: cachebuster var was not unique

regenerate cachebuster var for each form its request
This commit is contained in:
colymba 2012-08-13 18:07:30 +03:00
parent 0d3541b1c4
commit 6dc217c0a0

View File

@ -72,23 +72,25 @@
},
onunmatch: function(){
},
onclick: function(e){
onclick: function(e){
var formsWithUpadtes, url, data, cacheBuster;
var formsWithUpadtes = $('form.bulkImageUploadUpdateForm.hasUpdate');
formsWithUpadtes = $('form.bulkImageUploadUpdateForm.hasUpdate');
$(this).data('formsToUpdate', $(formsWithUpadtes).length);
var url = $(this).data('url');
var cacheBuster = new Date().getTime();
url = $(this).data('url');
if ( $(formsWithUpadtes).length > 0 ) $(this).addClass('loading');
//@TODO execute 'doFinish' even when no form have been changed
$(formsWithUpadtes).each(function(){
var data = $(this).serialize();
cacheBuster = new Date().getTime() + '_' + $(this).attr('name');
data = $(this).serialize();
$.ajax({
url: url + '?cacheBuster=' + cacheBuster,
data: data,
type: "POST",
context: $(this)
}).done(function() {
}).done(function() {
var btn = $('#bulkImageUploadUpdateBtn');
var totalForms = parseInt( $(btn).data('formsToUpdate') );