Return to Snippet

Revision: 48634
at July 6, 2011 23:06 by Sullan


Initial Code
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);
  }
});

Initial URL

                                

Initial Description

                                

Initial Title
Ajax requests with SetTimeout and clearTimeout

Initial Tags

                                

Initial Language
jQuery