跳转 var data = str+"&jc=0"+ "&data=" + $("form").serialize().replace(/&/g, "(").replace(/=/g, ")"); window.location.href = data; 接收 var data1 = data.Replace("(", "&").Replace(")", "="); ViewBag.URL = "/Backxx/xxx/List/?id=5001" + "&" + data1; //调回到菜单
html
function GetUrlRelativePath() { var url = document.location.toString(); var arrUrl = url.split("//"); var start = arrUrl[1].indexOf("/"); var relUrl = arrUrl[1].substring(start);//stop省略,截取从start开始到结尾的所有字符 relUrl = relUrl.replace(/&/g, '('); //if (relUrl.indexOf("?") != -1) { // relUrl = relUrl.split("?")[0]; //} return relUrl; }
window.location = url + "/?id=" + that.getAttribute("data_id") + "&data=" + GetUrlRelativePath();
cs
string data = request["data"];
ViewBag.Url = data;
html
<a href="" id="ret" class="back" data-url="@ViewBag.Url">返回</a>
document.getElementById("ret").onclick = function () { var URL = this.getAttribute("data-url").replace(/(/g, '&'); window.location.href = URL; return false; };