Hi, ok, simple question i think. I have this update function: function divUpdate(id, url, par, val){ new Ajax.Updater(id, url, { method: ''get'', parameters: {par: val} }); } And I want to use it like this: onclick="divUpdate(''divID'', url.asp'' , ''parameter'', ''value'');" The parameter doesn''t get passed and i would really like to know why i can''t seem to get the variable parameter name to work.... tnx --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
CoolJazz wrote:> Hi, > > ok, simple question i think. > > I have this update function: > > function divUpdate(id, url, par, val){ > new Ajax.Updater(id, url, { > method: ''get'', > parameters: {par: val}Here''s your problem. The left hand side of a name-value pair in JSON is a literal value. You simply cannot use a variable there. Try something like this: var params = {}; params[par] = val; And then later: parameters: params -- Michael Peters Developer Plus Three, LP --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Tnx for the swift reply I kinda worked around it but i would still like to understand this.. jscript newbie here ;) I tried this function divUpdate(id, url, par, val){ var params = {}; params[par] = val; new Ajax.Updater(id, url, { method: ''get'', parameters: params; }); but that is obviously not right. appreciate any help Cheers } On Apr 2, 11:42 pm, Michael Peters <mpet...-aUYv5hkjw45l57MIdRCFDg@public.gmane.org> wrote:> CoolJazz wrote: > > Hi, > > > ok, simple question i think. > > > I have this update function: > > > function divUpdate(id, url, par, val){ > > new Ajax.Updater(id, url, { > > method: ''get'', > > parameters: {par: val} > > Here''s your problem. The left hand side of a name-value pair in JSON is a > literal value. You simply cannot use a variable there. Try something like this: > > var params = {}; > params[par] = val; > > And then later: > parameters: params > > -- > Michael Peters > Developer > Plus Three, LP--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> > but that is obviously not right.:-) Correction, that is exactly right, just like Michael said. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> -----Original Message----- > And I want to use it like this: > > onclick="divUpdate(''divID'', url.asp'' , ''parameter'', ''value'');"Just a quick note, your quotes are not matching in the example above (ie: the missing start quote around url.asp) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
when i have this: function divUpdate(id, url, par, val){ var params = {}; params[par] = val; new Ajax.Updater(id, url, { method: ''get'', parameters: params; }); with this: onclick="divUpdate(''divID'', ''url.asp'' , ''parameter'', ''value'');" I get an "object expected'' error in IE when i click the button. On Apr 3, 12:17 am, "Sherif Zaroubi" <szaro...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > -----Original Message----- > > And I want to use it like this: > > > onclick="divUpdate(''divID'', url.asp'' , ''parameter'', ''value'');" > > Just a quick note, your quotes are not matching in the example above (ie: > the missing start quote around url.asp)--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
There''s a missing } in your post? On 4/3/07, CoolJazz <erikjanlam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > when i have this: > > function divUpdate(id, url, par, val){ > var params = {}; > params[par] = val; > new Ajax.Updater(id, url, { > method: ''get'', > parameters: params; > }); > > with this: > > onclick="divUpdate(''divID'', ''url.asp'' , ''parameter'', ''value'');" > > I get an "object expected'' error in IE when i click the button. > > On Apr 3, 12:17 am, "Sherif Zaroubi" <szaro...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > -----Original Message----- > > > And I want to use it like this: > > > > > onclick="divUpdate(''divID'', url.asp'' , ''parameter'', ''value'');" > > > > Just a quick note, your quotes are not matching in the example above > (ie: > > the missing start quote around url.asp) > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
No, that''s not it. Any other suggestions? On 3 apr, 00:50, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> There''s a missing } in your post? > > On 4/3/07, CoolJazz <erikjan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > when i have this: > > > function divUpdate(id, url, par, val){ > > var params = {}; > > params[par] = val; > > new Ajax.Updater(id, url, { > > method: ''get'', > > parameters: params; > > }); > > > with this: > > > onclick="divUpdate(''divID'', ''url.asp'' , ''parameter'', ''value'');" > > > I get an "object expected'' error in IE when i click the button. > > > On Apr 3, 12:17 am, "Sherif Zaroubi" <szaro...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > -----Original Message----- > > > > And I want to use it like this: > > > > > onclick="divUpdate(''divID'', url.asp'' , ''parameter'', ''value'');" > > > > Just a quick note, your quotes are not matching in the example above > > (ie: > > > the missing start quote around url.asp)--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---