Jump to content

Hello everyone ajax newbie


gvpm

Recommended Posts

hello i have obtained the prototype.js and using it for my comments the problem is im not to good with js. i want this code:

 

<script type="text/javascript">
function send(){
var params = Form.serialize($('commentsForm'));
new Ajax.Updater('commentdiv', 'comments.php', {asynchronous:true, parameters:params,});
}
</script>

 

to basically when i click my submit buttin a loading image appear...if anyone have already posted this im sorry for the repost i tried searching .... thanks.

Link to comment
https://forums.phpfreaks.com/topic/41670-hello-everyone-ajax-newbie/
Share on other sites

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