zoukankan      html  css  js  c++  java
  • EXTJS 实现session 的另一种方法

    JS:
    1. function showResult(btn){
    2.         //Session过期,返回登录页面
    3.         top.location.href='login.html';
    4. };
    5. check_login=function(){
    6. Ext.Ajax.request({
    7.                     url: './inc/session.asp',
    8.                     success: function(response, options) {
    9.                       var responseArray = Ext.util.JSON.decode(response.responseText);                                            
    10.                             if(responseArray.success==false){
    11.                                                                 Ext.MessageBox.show({
    12.                                                                         title: '会话超时',
    13.                                                                         msg: '您的会话已由于超时而过期,请您重新登录!',
    14.                                                                         buttons: Ext.MessageBox.OK,
    15.                                                                         fn: showResult,
    16.                                                                         icon: Ext.MessageBox.WARNING
    17.                                                                 });
    18.                                                         }
    19.                     }
    20.             });
    21. };
    22. check_login();
    复制代码
    ASP:
    1. <% response.ContentType="text/html;charset=utf-8" %>
    2. <%
    3. IF session("code")<>"" Then
    4.         Response.Write "{success: true,session:'"&session("code")&"'}"
    5. Else
    6.         Response.Write "{success: false,session:'login.html'}"
    7. End IF
    8. %>
    复制代码
    我想不用我再解释什么了吧,将JS代码引用到共用JS部分中就可以了。
  • 相关阅读:
    浅谈Java两种并发类型——计算密集型与IO密集型
    设置线程池的大小
    Java 四种线程池newCachedThreadPool,newFixedThreadPool,newScheduledThreadPool,newSingleThreadExecuto
    gitlab的简单操作
    GitHub vs GitLab:区别?
    前端小知识汇总
    花里胡哨的CSS集锦
    码云如何上传代码
    小程序自定义底部导航
    Vue实践过程中的几个问题
  • 原文地址:https://www.cnblogs.com/holyes/p/5005d9c48385fd476ec1e6c06b67caf5.html
Copyright © 2011-2022 走看看