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
  • 9,801
  • 11
  • 41
  • 63
Julian Camilleri
  • 2,582
  • 1
  • 22
  • 33

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,427
  • 3
  • 42
  • 60
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.