I'm developing in javascript and would like to insert a script only if a condition is verified.
For example:
var a = exampleVariable;
if (a == conditionIwant) {
// append to head:
<script src="http://code.jquery.com/jquery-1.5.js"> </ script>
}; //or something like this
How can I insert jquery.js only if a condition is true?