0

I'm looking into what is the correct way to pass multiple values for the same parameter name in a GET request in sails, but dont know how to achieve this.

I have seen url like this

http://url/action?id=a&id=b 
http://url/action?id=x,y,z

So, can someone point me at an official reference source or any example?

rash111
  • 1,307
  • 4
  • 19
  • 35

1 Answers1

0

So if you need to send multiple ids by using get, you can send array inside get params...

So url should look like this:

http://url/action?id[]=1&id[]=2&id=3

In controller you can get this values with var ids = req.param("id");

You will get this -> ids = ["1", "2", "3"]

hlozancic
  • 1,489
  • 18
  • 31