开发者

jQuery setTimeout with overlay on submit

I have a form that uses a jQTools overlay and jQuery .ajax submission routine. I would like the overlay to close once the success/error message has been displayed. How would I incorporate a setTimeout into this (only after success/error msg has been displayed) the ID of the overlay is "#overlayForm"

    $.ajax({
        type: $(form).attr('method'),
        url: form.action,
        data: dataString,
        clearForm: true,
        success: function (data) {
            if (data == "Mail sent") {
                $("#formWrap, #supportHdln").hide();
                $("#thankYou").html('<h2><span>Thank You | </span>We have received your request.</h2><p>A Customer Service Representative from Kinetick will contact you shortly</p>').fadeIn("slow");

            } else {开发者_如何学Go
                $("#formWrap, #supportHdln").hide();
                $("#error").html('<h2"><span>Uh Oh | </span>We have encountered an error in your submission.</h2><p> Please check that all required form fields were filled out, if that does not resolve the issue, please <a href="mailto:support@kinetick.com?subject=Cancelling Kinetick Account Help">email</a> us here.</p>').fadeIn("slow");
            }
        }
    });
    return false;
}


The simplest thing I suppose is an anonymous function:

setTimeout(function(){$("#overlayForm").hide();},1000);

I have looked at the documentation of Jquery Tools, I think you must talk about this:

http://flowplayer.org/tools/overlay/index.html

They talk about "close()".

Then it would be:

$("#overlayForm").close();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜