load jQuery in another js file
<p>I have a JavaScript file, which also uses jQuery in it too. To load it, I wrote this code:</p>

<pre><code>function include(filename)
{
    var head = document.getElementsByTagName('head')[0];
    var script = document.createElement('script');
    script.src = filename;
    script.type = 'text/javascript';
    head.appendChild(script)
}

include('http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js');
alert("1");

$(document).read(function(){});
alert("2");
</code></pre>

<p>This fires <code>alert("1")</code>, but the second <code>alert</code> doesn't work. When I inspect elements, I see an error which says that <code>$</code> in not defined.</p>

<p>How should I solve this problem?</p>
