添加一个
timeout
$.ajax({ type : "GET", url : "http://otherdomain.com/somePage.html", data: params, timeout:3000, dataType : "jsonp", jsonp : "jsonp", success : function (response, textS, xhr) { alert("ok"); }, error : function (xmlHttpRequest, textStatus, errorThrown) { alert("not ok " + errorThrown); if(textStatus==='timeout') alert("request timed out"); } });


