Load jQuery with Javascript and use jQuery
<p>I am appending the jQuery library to the dom using:</p>

<pre><code> var script = document.createElement('script');
 script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js';
 script.type = 'text/javascript';
 document.getElementsByTagName('head')[0].appendChild(script);
</code></pre>

<p>However when I run:</p>

<pre><code>jQuery(document).ready(function(){...
</code></pre>

<p>The console reports the error:</p>

<pre><code>Uncaught ReferenceError: jQuery is not defined
</code></pre>

<p>How do I load jQuery dynamically as well as use it once it is in the dom?</p>
