首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Ajax >

jQuery中Ajax函数的超时处置

2012-11-23 
jQuery中Ajax函数的超时处理jQuery中进行Ajax请求的高级函数有$.get()$.post()但这些函数不能对超时进行

jQuery中Ajax函数的超时处理
jQuery中进行Ajax请求的高级函数有$.get();$.post();
但这些函数不能对超时进行处理,要进行超时处理,必须用低层Ajax函数:$.ajax();
示例代码:

<html>  <head>    <script src="jquery-1.2.js"></script>    <script>      $(document).ready(        function () {          $.ajax({            url: "ajax.error.php",            timeout: 1000,            error: function (xmlHttpRequest, error) {              console.info(xmlHttpRequest, error);            }          });        }      );    </script>  </head></html>

热点排行