title: How to cancel an ajax request or third party js request when no response after x time w/ abort()
body: <p>Curious what are some of your solutions, elegantly, that deal with block js calls / ajax calls that take too long reaching out to third party sites for data/info.</p>
  
  <p>Lately, I've been contending with some scripts/ajax requests in which the server is either down or not responding and literally blocks my page. They are suppose to be async.</p>
  
  <p>So, I want to abort the call after x time.</p>
  
  <pre><code>var request = $.ajax({
      type: 'POST',
      url: 'someurl',
      success: function(result){}
  });
  </code></pre>
  
  <p>then use: request.abort() if it takes too long.</p>
  
  <p>But I am thinking I can use a deferred/promise here, with a timeout ability and call abort if my promise doesn't come back in say 1000ms.</p>
  
  <p>Your thoughts?</p>
  
  <p>My bad for not referring to the timeout attr of the ajax request. I didn't want to wrap the abort() in a setTimeout, but having the jQuery ajax api w/ timeout is what I need. I should have seen this. thanks all.</p>