var x = e.pageX;
var y = e.pageY;
Which is the easiest way to save those jQuery variables in a PHP session.
$.ajax({
url: '/update-session.php',
data: {"x":e.pageX,"y":e.pageY},
type: 'post',
success:function(data){
// if you care.
}
});
update-session.php:
$_SESSION['pageX'] = $_POST['x'];
$_SESSION['pageY'] = $_POST['y'];
Make an AJAX request to a PHP page that saves them in the session.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.