I am using jQuery 1.4 and I am trying to add DIVs containing javascript files from another domain. I have the following inline code at the end of the body, right after loading jQuery:
<script src="jquery-1.4.3.min.js"></script>
<script src="scripts.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
var html = "<div><script type='text/javascript' src='http://example.com/foo'></script></div>";
$("#container").append(html);´
});
</script>
The problem is that the conclusion is:
"; $ (" # container "). append (html);}});
and it’s not even displayed in #container, but in the lower part of the body where the javascript code is located.
EDIT: The javascript file inserts html for advertising, so it cannot be loaded into the document header.
source
share