Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery ajax pass data which has multiple value with the same key

Tags:

jquery

ajax

Is there a easy way to build an ajax query like this with jquery?

http://www.test.com/?value=happy&value=good&value=day

I tried

$.getJSON('http://www.test.com/', {'value': ['happy','good','day']});

but the result becomes http://www.test.com/?value[]=happy&value[]=good&value[]=day

like image 218
lucemia Avatar asked Aug 11 '12 15:08

lucemia


1 Answers

Just for anyone who comes here through search, you can use the traditional parameter to $.ajax and set it to true then you will get:

http://www.test.com/?value=happy&value=good&value=day.

like image 67
mpcabd Avatar answered Sep 28 '22 19:09

mpcabd