Stupid question I am sure, but what is the javascript syntax with the script.aculo.us framework to do the following: Name: <input type="text" name="name" /> Age: <input type="text" name="age" /> <input type="button" value="Send" onclick="sendform()" /> <div id="blah"></div> What I want it to do is send the name and age to a php script (via AJAX) and then output the results (whatever the script returns) into the "blah" div. Any help would be much appreciated. Cheers :-) --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Hey there, FiRe a écrit :> Name: <input type="text" name="name" /> > Age: <input type="text" name="age" /> > <input type="button" value="Send" onclick="sendform()" /> > <div id="blah"></div>First, ideally you''d: a) have that in a regular form with a valid action (just so it can degrade gracefully) b) use UJS to bind your form''s submit event [or at the very least in this instance, your button''s click event Now, on to the sendform function, assuming your inputs ARE in a form, and this form''s ID is ''myForm'', and you''re going for a POST request: new Ajax.Updater(''/your/script/url'', ''blah'', { parameters: Form.serialize(''myForm'') }); That should do the trick. -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Ah thats the syntax, thanks! --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Oh and in case anyone refers to this post, its actually the other way around: new Ajax.Updater(''blah'', ''/your/script/url'', { parameters: Form.serialize(''myForm'') }); --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---