Hello guys,
I have a strange problem with asynchronous loading.
There is this function, it loads asynchronously, no problem.
test.js has some javascript code, like;
document.write ('Let me write on screen');
My problem is, it doesn’t print this code on screen.
Do you have any idea about why? What am I doing wrong?
All the help is appreciated.
<script type="text/javascript">
(function () {
function async_load() {
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'test.js';
var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
}
if (window.attachEvent)
window.attachEvent('onload', async_load);
else
window.addEventListener('load', async_load, false);
})();
</script>