1. Method One: JS Regular expression: request path: http://127.0.0.1/pec/jsp/member/refundOrder.jsp?status=4
<script>
var status= getUrlAttribute(‘status‘);
if(null!=status)
{
alert(status);
}
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r != null) {
return unescape(r[2]);
}
return null;
}
</script>
2. Square Two:
Function getUrlParam(parameName){
//location.search is a string starting from the ? of the current URL, ie the query string
Var query = (location.search.length > 0 ? location.search.substring(1) : null);
If(null!=query)
{
Var args = new Object( );
Var pairs = query.split("&");
For(var i = 0; i < pairs.length; i++)
{
Var pos = pairs[i].indexOf("=");
If (pos == -1)
Continue;
Var argname = pairs[i].substring(0,pos);
Var value = pairs[i].substring(pos+1);
Value = decodeURIComponent(value);
Args[argname] = value;
}
/ / Get the value according to the key name
Return args[parameName];
}
Return null;
}
Assign a value to JS based on the property name of the URL