you wanna do something like this?

function check(){
    $.ajax({
        ...
        success:function(){
            f(checkCondition) {
                closeOverlay();
            } else {
                setTimeout(check, 5000)
            }
        }
    });
}
openOverlay();
check();

2009/3/3 Cyril Wan <cyr...@technicost.com>:
>
> No one? I thought this was a no brainer  but i just can't get my head around
> it...
> May be I can try asking it a different way...
>
> Let's say I have a long process that takes 30 - 40 secs , I need to open a
> Loading overlay that displays an icon that it is processing and at the same
> time I need to check the server if it is ready to display. When rready, it
> needs to refresh the page to the new URL posted by the server.
>
> Thanks
> C
> - Показать цитируемый текст -
> -----Original Message-----
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
> Behalf Of Cyril
> Sent: March-02-09 9:22 PM
> To: jQuery (English)
> Subject: [jQuery] Replacing META REFRESH by AJAX , Loading and Post
>
>
> Hi,
>
> I'm trying replace a META REFRESH every 5 secs with AJAX.
> On Submit of the form, I'd like to trigger the process, and use
> SetInterval
> to check a URL whether it has finished.
> Right now, the trigger will call a program callEquifax, which will
> display a
> page with another META REFRESH until the program is ready to display a
> result where the META REFRESH URL is the final output.
>
> Now I'd like to replace this using AJAX, here's what Ive attempted
> below but
> I'm missing a way to analyse the URL, not the output html, and if I
> detect a
> change in the location.href.
>
> Bottomline, how can I modify it so that, on Submit:
> 1. It displays the Loading Icon
> 2. HTTP AJAX POST callEquifax
> 3. Check every 5 secs using AJAX to see if the process has ended, if
> not
> loop again.
> 4. Finally refresh the page to the new Page to show the output when it
> is
> ready to be displayed.
>
> Thanks
>
> Below is the snippet on where I am at... I was able to trigger the
> process,
> and I am trying to replace a META REFRESH URL
>
> $(function(){
>        $('#Submit').click(function(){
>                //Loading
>                alert('AJAX Submit Function');
>                $('<div id="overlay"/>').appendTo('body').fadeIn(500);
>                $.ajax({
>                        type: "POST",
>                        url: "/eDevScripts/MGrqispi101.dll",
>                        data:
> "APPNAME=CreditApp&PRGNAME=callEquifax&ARGUMENTS=-
> A2408895331377327030220090
> 90018&prgtype=ADD&customerType=" + $('#customerType').val()+
> "&businessName=" + $('#businessName').val() + "&fileNumber=" +
> $('#fileNumber').val() + "&listSimilars=" + $('#listSimilars').val() +
> "&firstName=" + $('#firstName').val() + "&lastName=" + $
> ('#lastName').val()
> + "&dob=" + $('#dob').val() + "&streetNo=" + $('#streetNo').val() +
> "&streetName=" + $('#streetName').val() + "&city=" + $('#city').val()
> +
> "&province=" + $('#province').val() + "&postalCode=" +
> $('#postalCode').val() + "&phoneNumber=" + $('#phoneNumber').val() +
> "&ext="
> + $('#ext').val(),
>                        success: function(htmlOutput){
>                                alert("Please wait while we process
> the
> transaction!" + htmlOutput);
>                                // Need a way to use SetInterval()
>                        }
>                });
>                return false;
>
>        });
>
>
> });
>
>



-- 
Максим Игоревич Гришаев,
AstroStar.ru

Reply via email to