I have an object like this:
var queryObject= {
name: \'Shwetanka\',
subjects: [\'Mathematics\', \'Physics\', \'Computers\'],
stream: \'scie
When we have fields with same name in a form and it is submitted via GET/POST
, it is bound to be send as an array of params with the same name.
And the server would be expecting the values as such. So, Even if you somehow remove that []
, it ceases to be an array, and the server will get only one value.
jQuery param method is designed, with the same thing in mind.
Check out examples in http://api.jquery.com/jQuery.param/.
I've found the solution. I just have to pass 'traditional=true' in $.param(queryObject, true)
. This generates the query string i want.