title: Trying to load an API and a JS file dynamically
body: <p>I am trying to load Skyscanner API dynamically but it doesn't seem to work. I tried every possible way I could think of and all it happens the content disappears.</p>
  
  <p>I tried console.log which gives no results; I tried elements from chrome's developers tools and while all the content's css remains the same, still the content disappears (I thought it could be adding display:none on the html/body sort of). I tried all Google's asynch tricks, yet again blank page. I tried all js plugins for async loading with still the same results.</p>
  
  <p>Skyscanner's API documentation is poor and while they offer a callback it doesn't work the way google's API's callback do.</p>
  
  <p>Example: <a href="http://jsfiddle.net/7TWYC/" rel="nofollow">http://jsfiddle.net/7TWYC/</a></p>
  
  <p>Example with loading API in head section: <a href="http://jsfiddle.net/s2HkR/" rel="nofollow">http://jsfiddle.net/s2HkR/</a></p>
  
  <p>So how can I load the api on button click or async? Without the file being in the HEAD section. If there is a way to prevent the document.write to make the page blank or any other way. I wouldn't mind using plain js, jQuery or PHP.</p>
  
  <p><strong>EDIT:</strong> </p>
  
  <p>I've set a bounty to 250 ontop of the 50 I had previously.</p>
  
  <p>Orlando Leite answered a really close idea on how to make this asynch api load although some features doesn't work such as selecting dates and I am not able to set styling.</p>
  
  <p>I am looking for an answer of which I will be able to use all the features so that it works as it would work if it was loading on load.</p>
  
  <p>Here is the updated fiddle by Orlando: <a href="http://jsfiddle.net/cxysA/12/" rel="nofollow">http://jsfiddle.net/cxysA/12/</a></p>
  
  <p>-</p>
  
  <p><strong>EDIT 2 ON Gijs ANSWER:</strong></p>
  
  <p>Gijs mentioned two links onto overwriting document.write. That sounds an awesome idea but I think it is not possible to accomplish what I am trying.</p>
  
  <p>I used John's Resig way to prevent document.write of which can be found here: <a href="http://ejohn.org/blog/xhtml-documentwrite-and-adsense/" rel="nofollow">http://ejohn.org/blog/xhtml-documentwrite-and-adsense/</a></p>
  
  <p>When I used this method, I load the API successfuly but the snippets.js file is not loading at all. </p>
  
  <p>Fiddle: <a href="http://jsfiddle.net/9HX7N/" rel="nofollow">http://jsfiddle.net/9HX7N/</a></p>