0

I want to navigate through pages and state a variable 's' between them with a value, I usually do it "name.php?s=p" for example, but I thought there is a way to:

www.myweb.com/?s=p

For example.

I need to get the value inside the ?s= and read whats in it.

I tried this but it doesn't seem to work:

console.log($(location).attr('s'));

Is it possible with jquery?

Rahil Wazir
  • 10,007
  • 11
  • 42
  • 64
Julian Camilleri
  • 2,975
  • 1
  • 25
  • 34

2 Answers2

0

Use https://github.com/allmarkedup/purl plugin and write below code. In your case you want to search for "s" then below code should work.

 $.url().param('s');
Neel
  • 11,625
  • 3
  • 43
  • 61
0

You can send the variable with a Post Action between page and another, instead of GET method, if you are using the Rewrite mode.