Skip to content
This repository has been archived by the owner on Mar 16, 2023. It is now read-only.

Commit

Permalink
add ajax delay
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Fiebig committed Feb 3, 2017
1 parent d59ef51 commit 6926d6a
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions faf-optim.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,19 @@ function optionsPage()
var images = [<?php echo implode(',', $ids); ?>];

jQuery.each(images, function(ix, val){
var data = {
'action': 'optimize',
'image': val
};

jQuery.post(ajaxurl, data, function (response) {
jQuery('#report').append(response);
jQuery('#counter').html((ix+1) + '/' + images.length + 'optimiert');
});

setTimeout( function(){
var data = {
'action': 'optimize',
'image': val
};

jQuery.post(ajaxurl, data, function (response) {
jQuery('#report').append(response);
jQuery('#counter').html((ix+1) + '/' + images.length + 'optimiert');
})
}, 500);

});
});
});
Expand Down

0 comments on commit 6926d6a

Please sign in to comment.