• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
学习笔记
Misaka的学习笔记
博客园    首页    新随笔    联系   管理    订阅  订阅
打工笔记----------------------------iframe重定向让父级页面跳转


"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;
      });

 

posted on 2023-11-18 10:11  我们打工人  阅读(241)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3