Home > Web Front-end > JS Tutorial > Transmitting and receiving values ​​​​of url in jsp

Transmitting and receiving values ​​​​of url in jsp

一个新手
Release: 2017-09-08 09:06:37
Original
1767 people have browsed it

Transmitting and receiving values ​​of url in jsp

Jsp passing value:

    var myurl="index.jsp?id="+id+"&name="+name;
    window.location.assign(encodeURI(myurl));
Copy after login

jsp receiving value:

    var url=decodeURI(location.href);    
    var tmp1=url.split("?")[1]; 
    var tmp2=tmp1.split("&")[0]; 
    var tmp3=tmp2.split("=")[1]; //获取数据
    var tmp4=tmp1.split("&")[1]; 
    var tmp5=tmp4.split("=")[1]; //id
    var tmp6=tmp1.split("&")[2]; 
    var tmp7=tmp6.split("=")[1]; //name
      var moduleData = tmp3; 
      var id =tmp5; 
      var name = tmp7;
Copy after login

It can also solve the Chinese garbled code when url is passing value.

The above is the detailed content of Transmitting and receiving values ​​​​of url in jsp. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template