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
https://forums.phpfreaks.com/topic/39545-help-to-put-a-loading-with-prototype/
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.