Pergunta

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.

Foi útil?

Solução

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
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top