日期:2014-05-16 浏览次数:20782 次
<html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Untitled Page</title> <script type="text/javascript" src="jquery-1.6.2.js"></script> <script type='text/javascript'> var nCount = 1; function chlink() { var strUrl = "GetStatus.ashx?Count="+nCount++; $.ajax({ url: strUrl, type: "get", dataType: 'text', cache: false, success: function (data) { if( "Error"==data ) { $("#date").html("Server status is error" ); } else { $("#date").html("Serever status is normal" ); } data = null; } }); strUrl = null; setTimeout('chlink()',100); } $(document).ready(function() { chlink(); }); </script> </head> <body> <div id="date"></div> </body> </html>
<html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Untitled Page</title> <script type="text/javascript" src="jquery-1.6.2.js"></script> <script type='text/javascript'> var nCount = 1; var req=null; var READY_STATE_UNINITIALIZED=0; var READY_STATE_LOADING=1; var READY_STATE_LOADED=2; var READY_STATE_INTERACTIVE=3; var READY_STATE_COMPLETE=4; function loadXMLDoc(url) { if( !req ) { alert(url); if (window.XMLHttpRequest) { req = new XMLHttpRequest(); } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } if (req) { req.onreadystatechange = processReqChange; } } // if (req) { //alert(url); req.open("GET", url, true); req.send(null); } } function processReqChange() { var ready=req.readyState; var data=null; if (ready==READY_STATE_COMPLETE) { data = req.responseText; //alert(data); if( "Error"==data ) { $("#ComputerDevice1").html("Server status is error" ); } else { $("#ComputerDevice1").html("Serever status is normal" ); } data = null; //req = null; setTimeout('GetContent()',1); } else { $("#date").html("NO"+nCount+" loading...["+ready+"]" ); } } function GetContent() { loadXMLDoc("GetStatus.ashx?Count="+(nCount++)); } $(document).ready(function() { GetContent(); }); </script> </head> <body> &l