Jump to content

How can I have a progress bar for this


TeddyKiller

Recommended Posts

I have some ajax code, done in jquery. I'm wanting a progress bar. The page takes so long to load. It can be 1 second, or it can take minutes. It all depends on whats exactly happening with it. Lets say a clan has 10 clan members. It updates those users with information grabbed by another site. This will give it time.

 

So with the ajax script, where it has "loading" I'd like some sort of progress bar, so that no matter how long it takes for the results to display from the other page, it'll always display them when the progress bar reaches 100% if you get me.

 

How can I do it?

$(function() {     
    $(".button").click(function() {
        URL = $(".URL").val();
        
        $("#flash").slideDown("slow").html('<span class="loading">loading</span>');

        $.ajax({
            type: "POST",
            url: "usercp/updateusers.php",
            data: {url: URL},
            cache: false,
            success: function(html){
                $("#results").prepend(html);
                $("#results").slideDown("slow");
                document.getElementById('memb').value='';
                document.getElementById('memb').focus();
                $("#flash").hide();
            }
        });
        
        return false;
    });   
});

Link to comment
https://forums.phpfreaks.com/topic/201570-how-can-i-have-a-progress-bar-for-this/
Share on other sites

Note: In the PHP File, we have a script that displays some usernames. Though with our method, it displays all the usernames at once, instead of one at a time. Can this be changed so that it does display 1 by 1.. instead of the ajax waiting until all is completed, and then display. The progress bar should display and load etc.. until the last username has been done.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.