开发者

Possible JQuery functions to use

I am currently working on a website which has a fixed header and body and within the body is a main DIV.

For the page to change, the contents of the main DIV is changed. (Not my development)

I would like to display a notice to the user (Please wait loading) for any DB requests to the server or if the page changes. (The c开发者_StackOverflowontents of the main DIV is changed for this to occur). Once the results from the DB has been returned or the main DIV has completed loading, I would like for the notice to be removed.

I am considering using JQuery to achieve this, by having a loader DIV within the body and for this to be visible when required and hidden when not.

What would be the best JQuery function to use to achieve my requirements?

There is no AJAX used on the site.

Many thanks


You're probably looking for .show() and .hide() Or, if you want to get fancy, .fadeIn() and .fadeOut()


Here's some pseudo-code:

$(document).ready
(
    function()
    {
        $("#cmdQuery").click
        (
            function()
            {
                setProgressMessage();
                executeQuery();
            }
        );
    }
);

function setProgressMessage()
{
    // show query in progress message
}

function closeProgressMessage()
{
    // close query in progress message
}

function executeQuery()
{
    serverQuery(localCallBackFunction);
}

function localCallBackFunction(result)
{
    // process result of query
    closeProgressMessage();
}

<input type="button" id="cmdQuery" Text="Execute Query" />


This is my all favorite bookmark on how to create a jQuery ajax webpage:

http://www.queness.com/post/328/a-simple-ajax-driven-website-with-jqueryphp

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜