//ajax异步提交,并且状态文本等于timeout时提示连接超时。timeout 是设置连接超时时间,超时时间可以通过全局jQuery.ajaxSetup设置
function jqueryAjaxLinkOutTimeTest(){$.ajax({
type: "POST",
url: "nihao.html",
timeout:1,
error:function(XMLHttpRequest, textStatus, errorThrown){
if(textStatus=="timeout"){
alert('链接超时');
}
},
success: function(msg){
alert( "Data Saved: " + msg );
}
});
www.haida360.com