Hi I''m a newbie to AJAX and prototype and am writing a simple application that calculates some figures in php given some variables from a form, and display the outcome in a DIV. I can get it to function using a single parameter like this: function doSums() { new Ajax.Updater(''fruits'', ''calculator2.php'', { method: ''post'', parameters: salary=$(''salary'').serialize(true) }); return false; } but I can''t pass more than 1 form element. I have tried: parameters: salary=$(''salary''), age=$(''age'').serialize(true) and parameters: $F(''salary''), $F(''age'').serialize(true) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Apologies: I am using prototype.js On May 13, 4:02 pm, McBlaue <emrys.hug...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi I''m a newbie to AJAX and prototype and am writing a simple > application that calculates some figures in php given some variables > from a form, and display the outcome in a DIV. I can get it to > function using a single parameter like this: > > function doSums() { > new Ajax.Updater(''fruits'', ''calculator2.php'', { method: ''post'', > parameters: salary=$(''salary'').serialize(true) }); > return false; > } > > but I can''t pass more than 1 form element. I have tried: > > parameters: salary=$(''salary''), age=$(''age'').serialize(true) > > and > > parameters: $F(''salary''), $F(''age'').serialize(true)--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I also have tried this but no go: new Ajax.Updater(''fruits'', ''calculator2.php'', { method: ''post'', parameters: Form.serialize(this) }); On May 13, 4:02 pm, McBlaue <emrys.hug...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi I''m a newbie to AJAX and prototype and am writing a simple > application that calculates some figures in php given some variables > from a form, and display the outcome in a DIV. I can get it to > function using a single parameter like this: > > function doSums() { > new Ajax.Updater(''fruits'', ''calculator2.php'', { method: ''post'', > parameters: salary=$(''salary'').serialize(true) }); > return false; > } > > but I can''t pass more than 1 form element. I have tried: > > parameters: salary=$(''salary''), age=$(''age'').serialize(true) > > and > > parameters: $F(''salary''), $F(''age'').serialize(true)--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
The answer is this (I was close, just needed to be more specific): new Ajax.Updater(''fruits'', ''calculator2.php'', { method: ''post'', parameters: form1.serialize() }); On May 13, 6:43 pm, McBlaue <emrys.hug...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I also have tried this but no go: > > new Ajax.Updater(''fruits'', ''calculator2.php'', { method: ''post'', > parameters: Form.serialize(this) }); > > On May 13, 4:02 pm, McBlaue <emrys.hug...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi I''m a newbie to AJAX and prototype and am writing a simple > > application that calculates some figures in php given some variables > > from a form, and display the outcome in a DIV. I can get it to > > function using a single parameter like this: > > > function doSums() { > > new Ajax.Updater(''fruits'', ''calculator2.php'', { method: ''post'', > > parameters: salary=$(''salary'').serialize(true) }); > > return false; > > } > > > but I can''t pass more than 1 form element. I have tried: > > > parameters: salary=$(''salary''), age=$(''age'').serialize(true) > > > and > > > parameters: $F(''salary''), $F(''age'').serialize(true)--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---