Jump to content

help to put a "loading" with prototype


felipeebs

Recommended Posts

Hi, I am using Prototype AJAX fremework and want to put a loading during the request:

 

The JS:

function protoAJAX(url,div,pars){
	var myAjax = new Ajax.Updater(
		place, url, 
		{method: 'get', parameters: pars});
}

In the page headers I've included the prototype.js and in the body I've created the menu and the centercontent div

The link:

<a href="#" onclick="protoAJAX('page.html','centercontent','')">Prototype</a>

A link to nothing, onclick call function protoAJAX that put page.html in centercontent div calling no special params to it

 

The javascript works correctlly but I don't know how to display the "Loading..." message

 

If anyone can help

Thanks ;)

Link to comment
Share on other sites

  • 2 weeks later...

I just posted this for someone else. Your should be able to convert it for your uses.

 

--Turn on the Loading message just before calling Ajax.Updater and then use the 'onComplete' option in the Ajax.Updater to turn it off:

 

function send(){
    /* displays the loading message */
    document.getElementById("theLoadingMessageID").style.display = "";

    var params = Form.serialize($('commentsForm'));
    new Ajax.Updater('commentdiv', 'comments.php', 
        { onComplete:function(){  /* turn off loading message */
                document.getElementById("theLoadingMessageID").style.display = "none"; },
           asynchronous:true, parameters:params 
        }
    );
}

 

http://wiki.script.aculo.us/scriptaculous/show/Ajax.Updater

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.