title: Error handling with JQuery When
body: <p>I am using JQuery <a href="http://api.jquery.com/jquery.when/" rel="nofollow">when</a>. The syntax looks like this:</p>
  
  <pre><code>$.when(
    // Get the HTML
    $.get("/feature/", function(html) {
      globalStore.html = html;
    }),
  
    // Get the CSS
    $.get("/assets/feature.css", function(css) {
      globalStore.css = css;
    }),
  
    // Get the JS
    $.getScript("/assets/feature.js")
  
  ).then(function() {
  
    // Add CSS to page
    $("&lt;style /&gt;").html(globalStore.css).appendTo("head");
  
    // Add HTML to page
    $("body").append(globalStore.html);
  
  });
  </code></pre>
  
  <p>My question </p>
  
  <ol>
  <li>How can I do error handling when one of the call to the server results in exception (failure scenario) or error handling for any other scenario?</li>
  <li>Since I am making Ajax request here, how can I define timeout period for the Ajax request?</li>
  </ol>