/ Published in: jQuery

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var reqTimeout = setTimeout(function() { alert("Request timed out."); }, 5000); var xhr = $.ajax({ type: "GET", url: "http://localhost:3000/", dataType: "script", success: function() { alert("success"); }, error: function() { alert("error"); }, complete: function() { clearTimeout(reqTimeout); } });
Comments
