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部分中就可以了。
  • 相关阅读:
    一个小判卷系统
    关于int main(int argc,char* argv[])详解
    2014微软编程之美复赛的解题报告
    解题报告CF266B 384A 339A
    由于第一天在博客园开博客,我随便写个解题报告吧,以前很少写
    阿里巴巴大数据竞赛
    新注册的博客,欢迎大家多多指教
    vue中forceupdate的使用
    钉钉小程序之参数有中文。encodeUri以及encodeURIComponent详解
    关于offsetX、offsetY、clientX、clientY、pageX、pageY、screenX、screenY的区别
  • 原文地址:https://www.cnblogs.com/holyes/p/5005d9c48385fd476ec1e6c06b67caf5.html
Copyright © 2011-2022 走看看