Jquery ajax pass data that have multiple values โ€‹โ€‹with the same key

Is there an easy way to create an ajax request 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 will be http://www.test.com/?value[]=happy&value[]=good&value[]=day

+7
source share
2 answers

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

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

+6
source

This url seems good:

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

in php you can access values โ€‹โ€‹like array

-one
source

All Articles