Response title
This is preview!




I have a js function that should get some advertisement js code from some server and place it in specified DOM element. It looks like this:
function LoadAd(scriptContainer)
{
var js = document.createElement("script");
js.async = true;
js.src ='someAdUrl';
var sHolder = document.getElementById(scriptContainer);
if (sHolder != null) {
sHolder.appendChild(js);
}
}
the argument 'scriptContainer' is an ID of DOM element, that should contain created js element.
I've checked, the js file is being loaded and here is it's content:
document.write('<!-- Some Message -->\n\n<a href="SomeUrl" target=\"_blank\">\n<img width=\"336\" height=\"110\" border=\"0\" src="someImageSource">\n</a>\n');When I put this js src directly in html:
<script src='someAdUrl'></script>
it works fine.
Now I wont to solve this problem getting content of that js file and calling eval for it. But I don't know how I can do this.
Is there any JQuery method that I can use?
Or maybe there is a better solution?
© 2012 jQuery Foundation
Sponsored by
and others.
