Possible Duplicate:
Passing javascript variable to PHP
Hi
I wonder if it’s possible to pass a variable from a jQuery script to a PHP-page and put the variable into a session variable like this:
$_SESSION['mapZoomArea'] = (isset($_GET['mapza']) ? $_GET['mapza'] : "";
I’m not sure how to pass the variable and the url to the server? Preciate some help!
Thanks!
If you want a dedicated service specifically for writing this value into the session, you probably should make it a POST request (GET will work too, but GET requests should be for data retrieval, not for writing to the server).
Therefore, simply create a new PHP page, let’s say “storezoomarea.php”, and have jQuery make an Ajax POST request to that page:
Then, on the server side, you can retrieve it from the _POST variable: