AJAX Progress bar

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Arancaytar

    AJAX Progress bar

    I am working on a servlet that takes fairly long to process, and I
    would like to keep the user updated on the progress with a status bar.

    I have already finished the necessary javascript and servlet code: The
    local script regularly polls the servlet, which uses the session to
    check on the progress of the other program and reports back with an
    XML file. The local script then updates the progress bar as necessary.

    This works nicely until I actually place it into a form. Apparently,
    submitting a form and "leaving" the current page in the browser
    somehow suspends the Javascript until the new page is built, which
    means that nothing happens while the servlet result page is loading.
    How can I make the progress bar script run until the server actually
    sends a response to my form submission, and the page is rebuilt?
  • SAM

    #2
    Re: AJAX Progress bar

    Arancaytar a écrit :
    I am working on a servlet that takes fairly long to process, and I
    would like to keep the user updated on the progress with a status bar.
    >
    I have already finished the necessary javascript and servlet code: The
    local script regularly polls the servlet, which uses the session to
    check on the progress of the other program and reports back with an
    XML file. The local script then updates the progress bar as necessary.
    >
    This works nicely until I actually place it into a form. Apparently,
    submitting a form and "leaving" the current page in the browser
    somehow suspends the Javascript until the new page is built, which
    means that nothing happens while the servlet result page is loading.
    How can I make the progress bar script run until the server actually
    sends a response to my form submission, and the page is rebuilt?
    a gif-anim ? showed/hidden when necessary.


    function progressBar(yes No) {
    if(yesNo)
    myBar = setInterval(fun ction(){$('bar' ).innerHTML += '+';},300);
    else { clearInterval(m yBar); $('bar').innerH TML = '';}
    }

    function queryHttpReques t ( url, argts ) {
    progressBar(tru e);
    http_request = new ... blah

    if(http_request ) {
    blah
    http_request.on readystatechang e = function() {
    progressBar(fal se);
    blah ...
    };
    blah ...
    }
    }

    Really the JS waiting bar is blocked during the request ?
    I can't test because I havn't slow requests.

    --
    sm

    Comment

    Working...