title: Asynchronously load images with jQuery
body: <p><strong>I want to load external images on my page asynchronously using jQuery</strong> and I have tried the following:</p>
  
  <pre><code>$.ajax({ 
     url: "http://somedomain.com/image.jpg", 
     timeout:5000,
     success: function() {
  
     },
     error: function(r,x) {
  
     }
  });
  </code></pre>
  
  <p>But it always returns error, is it even possible to load image like this?</p>
  
  <p>I tried to use <a href="http://api.jquery.com/load/" rel="noreferrer"><code>.load</code></a> method and it works but I have no idea how I can set timeout if the image is not available (404). How can I do this?</p>