Uggers2k
Uggers2k

Reputation: 351

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 contents 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

Upvotes: 1

Views: 63

Answers (3)

Marnix
Marnix

Reputation: 6547

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

Upvotes: 0

Chris B. Behrens
Chris B. Behrens

Reputation: 6295

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" />

Upvotes: 0

Brian Flanagan
Brian Flanagan

Reputation: 4642

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

Upvotes: 1

Related Questions