jquery .each progress bar
Hello,
I'm processing data on site using .each, everything works fine, but I'd like to make something like progress bar, because there is quite much data and it takes maybe 2 or 3 seconds, so I'd like to show user some progress bar. I have idea, how I would like to do that, but there is one problem. I have a div which is hidden by default and shows only when this processing is in progress, so i have something like
- $('#divid').show();
- $('.processdata').each(function() {
- // processing
- });
- $('#divid').hide();
but it doesn't work. I have found out that this div is shown just after the processing is done (and therefor it is immediately hidden). If I do
- $('#divid').show();
- alert(1);
- $('.processdata').each(function() {
- // processing
- });
- $('#divid').hide();
then it somehow works, div containg message about processing is shown, then alerted 1, then processing is done and then div is hidden.
What should I do to make it work without this alert()? Have anyone any idea what I'm doing wrong or what should I do?
Thanks