Let's start with some basic code that you can try out and then
follow-up with questions you may have.
First, some JavaScript:
function prepare(){
var form = $('my-form');
form.observe('submit', handle);
}
function handle(event){
event.stop();
var form = $('my-form');
new Ajax.Request('/my-page', { parameters:Form.serialize(form),
onComplete: callback } );
}
function callback(response){
alert(response.transport.responseText);
}
//----------------
And the HTML
<form id="my-form" action="/my-page">
<input type="submit" value="Submit this silly form!" />
</form>
<script type="text/javascript">
Event.observe(document, 'dom:loaded', prepare);
</script>
I haven't tested any of this code, but I think it should work. I
recommend getting yourself with the documentation on the Prototype
API: http://prototypejs.org/api
Have a great night.
-justin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---