Home  >  Article  >  Web Front-end  >  How to get the value in session in js

How to get the value in session in js

coldplay.xixi
coldplay.xixiOriginal
2021-03-12 14:20:2119696browse

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.

How to get the value in session in js

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn