"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; });
标签:function,success,父级,----------------------------,href,location,跳转,scope From: https://www.cnblogs.com/misakayoucn/p/17840124.html