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("出错了!!!"); 
               } 
           } 
       } 

  • 相关阅读:
    POJ 3630
    Codeforces Round #219 (Div. 2) D题
    Codeforces Round #232 (Div. 2) On Sum of Fractions
    Codeforces Round #232 (Div. 2) C
    撸呀撸的左手(KMP+DP)
    hdu poj KMP简单题目总结
    LCT总结
    bzoj1019 [SHOI2008]汉诺塔
    NOIP2016总结
    p1199八数码问题
  • 原文地址:https://www.cnblogs.com/zhuyeshen/p/10705685.html
Copyright © 2011-2022 走看看