title: Loading if Jquery if it failed to load
body: <p>I am trying to load jquery on to a page that may or may not have jquery. I simply use the typeof to determine if it  is loaded. My problem is that I want to check and see if it has been loaded after I load it from my CDN. That way if my CDN fails I can fall back to Google to make sure that code still loads. The only way I have gotten this to work so far is that I have to use two different Javascript files. I get no console errors what so ever. So to test I changed the URL of my CDN so that it wouldnt work, it loads all four lines of code. It doesnt ever see the first conditional being loaded. How can I check after my first conditional statement to see if jQuery was loaded successfully or not?</p>
  
  <pre><code>if (typeof jQuery == 'undefined') {
      document.write("&lt;script type=\"text\/javascript\" src=\"http:\/\/mysite\/scripts\/jquery-1.8.3.min.js\"&gt;&lt;\/script&gt;");
      document.write("&lt;script type=\"text\/javascript\" src=\"http:\/\/mysite\/scripts\/jquery-ui-1.9.2.min.js\"&gt;&lt;\/script&gt;");
  }
  if (typeof jQuery == 'undefined') {
      document.write("&lt;script type=\"text\/javascript\" src=\"http:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.8.3\/jquery.min.js\"&gt;&lt;\/script&gt;");
      document.write("&lt;script type=\"text\/javascript\" src=\"http:\/\/ajax.googleapis.com\/ajax\/libs\/jqueryui\/1.9.2\/jquery-ui.min.js\"&gt;&lt;\/script&gt;");
  }
  </code></pre>