Pass variable to jQuery function in another page ?
I have what I think is a simple question but I can't find an answer.
I have two html pages - one.html, two html.
one.html contains a jquery function that alerts the variable it is passed.
The problem is I want to call and pass the variable from another html page - two.html
How can I call and pass a variable to the jQuery function in one.html from two.html ?
Stick it in the query string:
var foo = 'bar';
window.location = 'two.html?foo=' + foo;
Then in two.html you can access that variable on the server side (e.g. with PHP: $_GET['foo']). Or with JS you can access it via window.location.search.