1

I'm a noob about javascript, I need some part from a Url like:

https://lets-talk-saku-gie-sakura.c9users.io/sala/?sala=important

I just need the "important" part, I've used location.search but the result is:

sala=important

How can I resolve this please?

Thank you

Gie-Sakura
  • 117
  • 2
  • 10

1 Answers1

1

You can split the strings. Normally, location.search starts from ? onward. You remove ? first using slice. Then, each param will be delimited by a &. Split by that first and you get an array of pairs. Then you go through each pair and split by =.

Joseph
  • 117,725
  • 30
  • 181
  • 234