zoukankan      html  css  js  c++  java
  • 回调函数实例

    var xmlHttpRequest;
    function fnquery(){
    var cypz = '${cpcyModel.cypz}';
    var ajx = 'true';
    xmlHttpRequest = new XMLHttpRequest(); 
            xmlHttpRequest.onreadystatechange = callback; 
            xmlHttpRequest.open("GET", "<%=webapp%>/cpcy/cpcyAction!list.dhtml?firstFlag=clear&ajax="+ajx, true);
            xmlHttpRequest.send(null);  
    }
    //回调函数 
       function callback() { 
       alert(xmlHttpRequest.readyState);
           //alert(xmlHttpRequest.readyState); 
           //5。接收响应数据 
           //判断对象的状态是交互完成 
           if (xmlHttpRequest.readyState == 4) { 
               //判断http的交互是否成功 
               if (xmlHttpRequest.status == 200) { 
                   //获取服务器器端返回的数据 
                   //获取服务器段输出的纯文本数据 
                  var responseText = xmlHttpRequest.responseText; 
                   alert(responseText);
              if("true" == responseText) {
             
    $("#form1").attr('action','cpcyAction!enterlist.dhtml');
    $("#form1").attr('method','post');
    $("#form1").submit();
    }
               } else { 
                   alert("出错了!!!"); 
               } 
           } 
       } 

  • 相关阅读:
    linux uniq 命令实用手册
    linux sort 命令实用手册
    linux awk 命令实用手册
    如何高效使用vim
    15个有趣好玩的linux shell 命令
    一篇文章带你编写10种语言HelloWorld
    如何用hugo 搭建博客
    c++中的exit()
    枚举数据类型C++
    常见的字符测试函数
  • 原文地址:https://www.cnblogs.com/zhuyeshen/p/10705685.html
Copyright © 2011-2022 走看看