Continued from previous question
I got the error "Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened."
So I try to use getElementbyId, and then changing the src:
<head>
<script>
function pos(url)
{
var posterior = document.getElementById("post");
posterior.src = url;
}
</script>
In the body,
<body>
<?php ***...to retrieve ID***?>
<script type="text/javascript">
var videoid = "<?php echo $id; ?>"; //Transfer ID to javascript
var url="http://......"+videoid; //Url string finished
pos(url); //Function call
</script>
<script id="post" type="text/javascript" src='http://xxx'></script>
Where should I execute or define the pos(url) function? The error becomes "Cannot set property 'src' of null" or "pos is not defined" if I place them on different sections.
Well If I use $(window).load on the pos function in head, the error becomes "Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened." again....