日期:2014-05-16 浏览次数:20664 次
function getIntervention(startdate,enddate) { var xmlhttp = false; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); if (XMLHttpRequest.overrideMimeType) { XMLHttpRequest.overrideMimeType("text/xml"); } } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } if(!xmlhttp) { window.alert("不能创建对象"); return false; } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { var jsondata=eval('('+xmlhttp.responseText+')'); document.getElementById("myDiv").innerHTML=jsondata.nbMissions; return jsondata; } else document.getElementById("myDiv").innerHTML=xmlhttp.status+"-"+xmlhttp.readyState; } xmlhttp.open("POST","proxy.jsp",true); xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); xmlhttp.send("url=http://aqueduc.kelcode.com/proc/gw.php&requestName=getIntervention&uid=UID_GATEWAY&startDate="+startdate+"&endDate="+enddate+""); }
function getIntervention(startdate,enddate) { var xmlhttp = false; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); if (XMLHttpRequest.overrideMimeType) { XMLHttpRequest.overrideMimeType("text/xml"); } } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } if(!xmlhttp) { window.alert("不能创建对象"); return false; } //同步不需要状态转换函数 /*xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { var jsondata=eval('('+xmlhttp.responseText+')'); document.getElementById("myDiv").innerHTML=jsondata.nbMissions; return jsondata; } else document.getElementById("myDiv").innerHTML=xmlhttp.status+"-"+xmlhttp.readyState; }*/ /////xmlhttp.open("POST","proxy.jsp",true); xmlhttp.open("POST","proxy.jsp",false);////////改成同步的 xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); xmlhttp.send("url=http://aqueduc.kelcode.com/proc/gw.php&requestName=getIntervention&uid=UID_GATEWAY&startDate="+startdate+"&endDate="+enddate+""); ////////////////////////////////// var jsondata=eval('('+xmlhttp.responseText+')'); document.getElementById("myDiv").innerHTML=jsondata.nbMissions; return jsondata; }