Transmitting and receiving values of url in jsp
Jsp passing value:
var myurl="index.jsp?id="+id+"&name="+name; window.location.assign(encodeURI(myurl));
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;
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!