前端url传值与接收值

发送:

    


接收:

一种方法:

    另一端采用js代码

function getQueryString(name) {
var result = window.location.search.match(new RegExp("[\?\&]" + name
+ "=([^\&]+)", "i"));
if (result == null || result.length < 1) {
return "";
}
return result[1];

}

        //接收值并alert出来userId

       var userId = getQueryString("userId");
       alert(userId);


猜你喜欢

转载自blog.csdn.net/Weidong32768/article/details/80736453