页面URL传参数及取参数
页面取参数 先写一个Js正则表达式
//获取Url参数 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; }
在用var取值
var type = getUrlParam("Type");
传参:
"EtpList.ashx?action=GetQueryList"
传参会用在AJAX方法的URL里
$.ajax( { type: "POST", url: "EtpList.ashx?action=GetQueryList", data: { page: page, count: count, type: type }, contentType: "application/x-www-form-urlencoded", dataType: "json", async: false, cache: false, success: function (data)
后台EtpList.ashx页面的GetQueryList会接收到ajax传的数值
让我们一起来学习C#吧~~~