ajax processing bar

With few lines of JavaScript and CSS you can make a simple AJAX progress bar. JavaScript will periodically ask for progress value and server will respond with XML. Progress value should be extracted from the XML and displayed as width of the DIV element. To start progress bar in this example, please click on the Start button and wait for a second to begin. If you have installed Firebug, open Net tab and watch how this page sends request to the Web server.

$(‘.ajax-progress’).css(‘display’,’none’);
$(this).parent().append(‘

 
Processing…

‘);
$(‘.ajax-progress:last’).css(‘display’,’block’);
$.get(Drupal.settings.basePath+’delete_these_nodes?delete_nodes=’+delete_nodes, function() {});
$(‘.ajax-progress’).fadeOut(10000, function() {
window.location.href = window.location.pathname;
});

Was this article helpful?

Related Articles