homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Ajax.Request (Scriptaculous Framework)

 4:50 pm on Aug 15, 2007 (gmt 0)

Experimenting with Ajax a little, I'm posting a form which was previously posted with your regular html, php on the page then processed the input and returned an error message or a success message.

Ofcourse, this message was only displayed with a page refresh, ie;

<div id="returnMessage">
<?php if($error){ echo '<h4>Error-'.$error.'</h4>';}?>

I've put a new ajax request in my form tag, onsubmit, which I can see with firebug is posting all of my form data correctly

onsubmit="new Ajax.Request('widgetsets.php',{asynchronous:true,parameters:Form.serialize(this)}); return false;"

I would essentially like the div "returnMessage" to update once a post has been processed, without reloading the rest of the page.

Is this possible?

I've been playing around with it for a while, trying things such as
onComplete:$('returnMessage').update('<?php echo $error;?>')



 3:14 am on Aug 16, 2007 (gmt 0)

onsubmit="new Ajax.Request('widgetsets.php',{asynchronous:true,parameters:Form.serialize(this)}); return false;"

Did you try this

onsubmit="new Ajax.Updater('widgetsets.php',{asynchronous:true,parameters:Form.serialize(this)}); return false;"


 3:15 am on Aug 16, 2007 (gmt 0)

correct one!

onsubmit="new Ajax.Updater(returnMessage,'widgetsets.php',{asynchronous:true,parameters:Form.serialize(this)}); return false;"


 8:02 am on Aug 16, 2007 (gmt 0)

I did but CRAZY things were happening

for example, a page refresh was happening,

also, a duplicate of the entire page appears within the 'returnMessage' div.

On the plus side, this dupe does display the correct status message haha!


 8:08 am on Aug 16, 2007 (gmt 0)

actually now it's just a page refresh thats happening, status returns correctly ofcourse


 3:53 pm on Aug 16, 2007 (gmt 0)


I was actioning the page which on which the form resided - by habit have always put form processing php on the same page as the form

hence the whole page was loading into the specified div..

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved