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