Reputation: 70406
I use jQuery to block ui like this
$('#send').click(function() {
$.blockUI({ message:
'<p id="loading"><img src="images/busy.gif" /> processing...</p>'});
send();
$(document).ajaxStop($.unblockUI);
setTimeout($.unblockUI, 2000);
});
send()
does some background processing and sets a response message in #loading tag. After the process is finished I want this message to stay for some seconds so I use the setTimeout but this does not work.
Any ideas?
Upvotes: 2
Views: 2881
Reputation: 17724
Your script seems to call the unblockUI
using ajaxStop
already? Have you tried to remove this line or set your timeout within the ajaxStop
handler?
UPDATE
You could try this:
$('#send').click(function() {
$.blockUI({ message: '<p id="loading"><img src="images/busy.gif" /> processing...</p>'});
send();
$(document).ajaxStop(function(){
setTimeout($.unblockUI, 2000);
});
});
Upvotes: 2
Reputation: 17900
You can use jQuery's delay([time in seconds])
function.
As far as I know, setTimeout
works on another workflow than the rest of the script.
Upvotes: 0