title: How to cancel a jquery.load()?
body: <p>I'd like to cancel a .load() operation, when the load() does not return in 5 seconds. If it's so I show an error message like 'sorry, no picture loaded'. </p>
  
  <p>What I have is...</p>
  
  <p>...the timeout handling:</p>
  
  <pre><code>jQuery.fn.idle = function(time, postFunction){  
      var i = $(this);  
      i.queue(function(){  
          setTimeout(function(){  
              i.dequeue();
              postFunction();  
          }, time);  
      });
      return $(this); 
  };
  </code></pre>
  
  <p>... initializing of the error message timeout:</p>
  
  <pre><code>var hasImage = false;
  
  $('#errorMessage')
      .idle(5000, function() {
  
          if(!hasImage) {
              // 1. cancel .load()            
              // 2. show error message
          }
      });
  </code></pre>
  
  <p>... the image loading:</p>
  
  <pre><code>$('#myImage')
       .attr('src', '/url/anypath/image.png')
       .load(function(){
           hasImage = true;
           // do something...
        });
  </code></pre>
  
  <p>The only thing I could not figure out is how to cancel the running load() (if it's possible).</p>
  
  <p><strong>Edit:</strong>  </p>
  
  <p>Another way: How do I prevent the .load() method to call it's callback function when it's returning?</p>