如何将会话值从第1页(.js)文件传递到第2页(.php)文件

I want pass the session value from .js files to php files.

$.session.set("myVar", TotalHotels);

Add this coding in js files and try to retrive in php page like this

var myVar= $.session.get('myVar');

But i got TypeError: $.session is undefined

to set a session variable you need to do it in php and use the nomenclature as follows:

$_SESSION["username"] = "Bob";

and then you need to have session_start() a the top of every php page that requires access to the session variables.

<?php
session_start();
...

and then you access it like:

$name=$_SESSION["username"];

then you can access that in javascript as follows:

var name='<?php echo "$name"; ?>' // gives name = 'Bob'