質問

Basically I want the query string ?foo%5B%5Bbar%5D%5D=whizbang to give me a result that looks like this:

{ 'foo' : { '[bar]' : 'whizbang' } }

I'm using rails at the moment, and instead of '[bar]' i'm getting 'bar' (ie the [] stripped out). I tried this in PHP for a comparison, which has '[bar' (rstripped of ]) this seems wrong to me also.

I am trying to work out if this is a bug that i need to log for rails.

I'm using JQuery.ajax to send an object that looks like that to rails.

役に立ちましたか?

解決

If you're trying to formulate the params in javascript and have access to jquery, you can use $.param:

$.param({ 'foo' : { '[bar]' : 'whizbang' } })
// => foo%5B%5Bbar%5D%5D=whizbang
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top