/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function loadJquery(onLoadListener){ loadJquery.loaded = false; var fileref = loadJSfile("https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"); fileref.hasStarteHelper = false; // usando variavel estatica if(! loadJquery.loaded){ fileref.onreadystatechange= function () { if(!this.hasStarteHelper){ if (this.readyState == 'complete' || this.readyState == 'loaded'){ onLoadListener(); loadJquery.loaded = true; } } }; fileref.onload= function () { if(!this.hasStarteHelper){ onLoadListener(); loadJquery.loaded = true; } }; }else{ onLoadListener(); } } function prepareToDisplay(){ // alert('adObj'); var executeWhenJqueryLoad = function(){ // alert('JqueryCarregado!'); $(document).ready(function(){ alert('JqueryCarregado!'); // displayAdInClassEl(null); }); }; loadJquery(executeWhenJqueryLoad); }