
Untitled
By: a guest on
Apr 30th, 2012 | syntax:
None | size: 0.55 KB | hits: 11 | expires: Never
<!DOCTYPE html>
<head>
<title>Poor man's script loader</title>
</head>
<body>
<div>Expected value: <b>1.6.1</b></div>
<div>Actual value: <b id="ret">Loading</b></div>
<script>
/**
* @function
*/
var scriptLoader = function(a,b,c,d,e){d=document;c=d.createElement('script');c.src=a;e=!b;c.onload=function(){!e&&b();e=!0;};d.body.appendChild(c);}
scriptLoader(
'https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js',
function(){
document.getElementById( "ret" ).innerHTML = window.jQuery.fn.jquery;
}
);
</script>
</body>