0

i have angularjs array with objects, for exampe:

names=[
{name:'Jani',country:'Norway'},
{name:'Hege',country:'Sweden'},
{name:'Kai',country:'Denmark'}]

i want to create link that send the array with GET method, something like:

mysite.php?names=[{name,country}]

is it possible?

Snow
  • 3,820
  • 3
  • 13
  • 39
  • You're likely looking for the following: https://stackoverflow.com/questions/6243051/how-to-pass-an-array-within-a-query-string – Jan Grimm May 19 '20 at 14:59

1 Answers1

0

You should be able to do that just make sure you URL encode it first: https://www.php.net/manual/en/function.urlencode.php and depending on your backend you might have to decode it.

Also, remember from a security perspective you may want to send this in the body because it's much easier for a user to manipulate the URL params. hope this helps!

Shawn Varughese
  • 450
  • 4
  • 17