我查jQuery似乎就有,可是现在整个系统用的都是prototype框架…有很多同步请求(必要),可有时候如果请求没有收到回复,就会造成IE下的浏览器卡死(极个别),虽然大多数都会过一段时间自动放弃请求,不过还是想找个方法判断超时…

解决方案 »

  1.   

    <script type="text/javascript" src="prototype.js"></script>
        <script type="text/javascript">
          function testAjaxRequest() {
            //$('testButton').disabled = 'true';
            var url = '/ajax.aspx';
            var myAjax = new Ajax.Request(
              url,
              {
                method: 'get',
                requestTimeout: 10,
                onSuccess: showResponse,
                onTimeout: onTimeout,
                onComplete: function() { },
                onException: function(e) { alert('onException(e): ' + e) }
              }
            );
          }      function onTimeout() {
            alert('onTimeout');
          }      function showResponse(originalRequest) {
            alert('showResponse: ' + originalRequest.responseText);
          }