From 6926d6ad59e4baed3f7228b69c7e7329f5db23ef Mon Sep 17 00:00:00 2001 From: Frank Fiebig Date: Fri, 3 Feb 2017 16:22:44 +0100 Subject: [PATCH] add ajax delay --- faf-optim.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/faf-optim.php b/faf-optim.php index 13ae832..8c745e4 100644 --- a/faf-optim.php +++ b/faf-optim.php @@ -117,15 +117,19 @@ function optionsPage() var images = []; 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); + }); }); });