RighteousRaven
2007-Jun-03 16:53 UTC
Prototype - problem with array to query string. Php needs []
I''m using prototype''s ajax objects to send an array to my PHP backend, but only the last element of the array is correctly received because prototype''s array output format is: arr=1&arr=2&arr=3 instead of: arr[]=1&arr[]=2$arr[]=3 Does anyone know of a quick workaround, or will I have to bipass this bug / unfeature? Thanks, RR --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Christophe Porteneuve
2007-Jun-03 17:29 UTC
Re: Prototype - problem with array to query string. Php needs []
RighteousRaven a écrit :> Does anyone know of a quick workaround, or will I have to bipass this > bug / unfeature?Sure: just name your freakin'' parameter ''arr[]''! -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: 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 -~----------~----~----~----~------~----~------~--~---
RighteousRaven
2007-Jun-03 17:36 UTC
Re: Prototype - problem with array to query string. Php needs []
I am using prototype''s ajax objects, so I have to pass the parameters in as an object. The syntax for what you are suggesting would be: {arr[]: myObj.getArray()} but that returns a syntax error. I think this was supposed to be fixed in v1.5.1 but apparently it wasnt. RR On Jun 3, 1:29 pm, Christophe Porteneuve <t...-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> wrote:> RighteousRaven a écrit : > > > Does anyone know of a quick workaround, or will I have to bipass this > > bug / unfeature? > > Sure: just name your freakin'' parameter ''arr[]''! > > -- > Christophe Porteneuve a.k.a. TDD > "[They] did not know it was impossible, so they did it." --Mark Twain > Email: t...-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 -~----------~----~----~----~------~----~------~--~---
Michael Peters
2007-Jun-03 21:36 UTC
Re: Prototype - problem with array to query string. Php needs []
RighteousRaven wrote:> I am using prototype''s ajax objects, so I have to pass the parameters > in as an object. The syntax for what you are suggesting would be: > {arr[]: myObj.getArray()} > but that returns a syntax error.Then quote the name. { ''arr[]'': myObj.getArray() }> > I think this was supposed to be fixed in v1.5.1 but apparently it > wasnt.It was fixed. It''s your Javascript knowledge that needed fixing :) -- 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 -~----------~----~----~----~------~----~------~--~---