Hey John

1 - Actually there was a little bug in my code - but I posted a fix to  
the gist.

2 - Its not actually altering anything unless theres a value in the  
top level object that is also an object. Here's some tests in the  
Firebug console (url decoded for readability):

 >>> $.param({'test': {1: 2}})
"test[1]=2"

 >>> $.param({'test[]': [1,2]})
"test[]=1&test[]=2"

 >>> $.param({'test': [1,2]})
"test=1&test=2"

--AQ


On Feb 19, 2009, at 11:14 AM, John Resig wrote:

>
> Does this syntax conflict with what's current done for PHP?
>  foo[]=bar&foo[]=baz
>
> I'm a newb at both PHP and Rails - so someone can feel free to  
> correct me here.
>
> --John
>
>
>
> On Thu, Feb 19, 2009 at 9:58 AM, Aaron Quint <[email protected]>  
> wrote:
>>
>> Hey All
>>
>> I just made the switch recently to jQuery from prototype and I'm
>> loving every minute of it :)
>>
>> I've been using it a lot with a Ruby on Rails backend, and one of the
>> things I need was a way to nest params like the way Rails handles
>> forms/objects, eg. with a Page object:
>>
>> page[name]=Foo&page[author]=Bar
>>
>> Unfortunately, $.param didnt translate objects this way, but adding
>> just a few simple lines made it work like a charm:
>>
>> http://gist.github.com/66948
>>
>> Now:
>>
>> $.param({page: {name: 'Foo', author: 'Bar'})
>>
>> Translates to above.
>>
>> Thought this might be helpful for other people working with Rails/
>> jQuery and with a little clean up could be a nice addition to core.
>>
>> Thanks!
>> --AQ
>>
>>>
>>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" 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/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to