Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7582779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:31:11+00:00 2026-05-30T18:31:11+00:00

I’ve got a jQueryUI progressbar that should show the percentage of a query done.

  • 0

I’ve got a jQueryUI progressbar that should show the percentage of a query done. Oracle has a nice system table that lets you see operations that will take more than 10 seconds. I’m trying to make staggered $.ajax calls to this query in order to refresh the progress bar.

Problem is, I can either get the loops to make rapid-fire requests without any wait time, or just delay the entire JavaScript from executing.

I start the first request by clicking my “Execute” button in a jQueryUI dialog.

$("#dlgQuery").dialog({
    buttons: {
        Execute: function () {
            $(this).dialog("close");
            StartLoop();
        }
    }
});

I’m trying to build either the StartLoop() function or make a recursive GetProgress() function. Ideally, I will have a public variable var isDone = false to act as my indicator for when to terminate the loop or stop recursively calling the function.

For simplicity I have just made a static loop that executes 100 times:

function StartLoop(){
    for (var i = 0; i < 100; i++) {
        GetProgress();
    }
}

And here’s my sample ajax request:

function GetProgress() {
    $.ajax({
        url: "query.aspx/GetProgress",
        success: function (msg) {
            var data = $.parseJSON(msg.d);
            $("#pbrQuery").progressbar("value", data.value);
            //recursive?
            //GetProgress();

            //if (data.value == 100) isDone = true;                
        }
    });
}

So what I’ve found is, so far:

setTimeout(GetProgress(), 3000) in StartLoop() freezes Javascript, and the dialog does not close (I assume, because it will wait until the query is done).

This one, pausecomp(3000) does much the same thing.

If I call either of these in the “success” function of my AJAX request, it gets ignored (probably because it’s starting another call asynchronously).

I’m kinda stuck here, any help would be appreciated, thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:31:12+00:00Added an answer on May 30, 2026 at 6:31 pm

    Instead of setTimeout(GetProgress(), 3000), you would want:

    function StartLoop(){
        for (var i = 0; i < 100; i++) {
            setTimeout(GetProgress(), 3000*i);
        }
    }
    

    Otherwise, all 100 will fire off after 3 seconds. Instead, you want 0, 3000, 6000, 9000, etc., i.e. 3000*i;

    Better, you could use setInterval and clearInterval:

    var myInterval = setInterval(GetProgress(), 3000);
    

    and in the callback, do:

    $.ajax({
        url: "query.aspx/GetProgress",
        success: function (msg) {
            var data = $.parseJSON(msg.d);
            $("#pbrQuery").progressbar("value", data.value);
    
            if (data.value == 100) {
                isDone = true;
                clearInterval(myInterval);
            }          
        }
    });
    

    clearInterval will stop it from calling GetProgress() again. Using the setInterval method means you don’t have to know how many poll loops you need up front. It will simply continue until you are done.

    Or better yet, you can call GetProgress() from the ajax callback, with the advantage that it will only poll again once you have a response from your query:

    function GetProgress() {
        $.ajax({
            url: "query.aspx/GetProgress",
            success: function (msg) {
                var data = $.parseJSON(msg.d);
                $("#pbrQuery").progressbar("value", data.value);
    
                if (data.value == 100) {
                    isDone = true;
                } else {
                    setTimeout(GetProgress(), 2000);
                }
            }
        });
    }
    

    Then just call GetProgress() once to initiate the loop.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
In my XML file chapters tag has more chapter tag.i need to display chapters

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.