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

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.