"top.location.href"是最外层的页面跳转
$.ajax({ url: URL + "SystemPrivileges/UserChangePW", data: { userName: userName, passWord: passWord, oldpwd: passWordold, token: token }, type: "post", dataType: "json", success: function(obj) { if (obj.success) { layer.alert("提交成功", { icon: 6 }, function() { // 清除本地存储的登录信息 localStorage.removeItem('token'); // 跳转到登录页面 top.location.href = './../../login.html'; }); } else { document.getElementById("span_tishi").innerHTML = obj.msg; } }, error: function(e) { console.log(e); }, complete: function() { }
"parent.location.href"是上一层页面跳转
app.controller("listController", function ($scope, $http) { $scope.policeList = $http.get(URL + "SystemPrivileges/GetRoleList?Token=" + token).success(function (response) { $scope.policeList = response.data; var id = $("#hid_role").val(); for (var i in $scope.policeList) { if ($scope.policeList[i].id == id) { //判断选中项. $scope.Police = $scope.policeList[i]; //设置选中项. break; } else { $scope.Police = $scope.policeList[0]; //设置选中项. } } }).catch(function (result) { parent.location.href = "./../../error.html"; }); $scope.changeClassification = function (Police) { $scope.policeList2 = $http.get(URL + "SystemPrivileges/GetRoleModel?Id=" + Police.id + "&Token=" + token).success(function (response) { $("#txt_Experience").val(response.data.frequency); }); }; });
"window.location.href"、"location.href"是本页面跳转
form.on('submit(add)', function (data) { $.ajax({ url: URL + "Block/PayTypeAdd", data: { Id: id, PlatformName: $("#txt_platformName").val(), PlatformUrl: $("#txt_platformUrl").val(), PlatformType: $("#txt_platformType").val(), Token: token }, type: "post", dataType: "json", success: function (obj) { if (obj.success) { layer.alert("提交成功", { icon: 6 }, function () { window.location.href = "PayList.html"; }); } else { document.getElementById("span_tishi").innerHTML = obj.msg; } }, error: function(e) { console.log(e); }, complete: function() { } }).catch(function (result) { window.location.href = "./../../error.html"; }); return false; });
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了