Reputation: 1229
im thinking if there is a way to run a jquery function like $.post even if the DOM's are not yet loaded..
Upvotes: 0
Views: 56
Reputation: 21563
Yes, if you place your script after jQuery has been loaded, you are free to execute any jQuery functions. However, DOM manipulation will, of course, be unreliable if you're outside of a $(document).ready()
block or similar.
Upvotes: 1
Reputation: 248
Yes you can, once jquery has loaded.
function checkJquery(){
if(typeof($)==undefined){
setTimeout(checkJquery,500);
} else {
start();
}
}
setTimeout(checkJquery,500);
Then write your code in start()
.
Upvotes: 1