Home >Web Front-end >JS Tutorial >How to get the value in session in js
JS method to obtain the value in the session: 1. You can make an AJAX request to the server and return the value in the session; 2. You can use the tag [4eed03230346664e54006e16f8581c1e] in JSP to Get the value in session.
The operating environment of this tutorial: Windows 7 system, JavaScript version 1.8.5, DELL G3 computer.
JS method to get the value in session:
session is the server object,
javascript is the client script, the operation you can do is to This value is output to the javascript of the page to participate in the operation using
4eed03230346664e54006e16f8581c1e
, but cannot be directly called with js
Method:
You can make an AJAX request to the server and return the value in the session.
Of course you can also use 4eed03230346664e54006e16f8581c1e
in JSP to get the value in the session, for example:
<script language="JavaScript"> function getMyName(){ var myName="<%=session.getAttribute("MYNAME")%>"; alert(myName); }
Related free learning recommendations: javascript video tutorial
The above is the detailed content of How to get the value in session in js. For more information, please follow other related articles on the PHP Chinese website!