I know this answer has been repeated, but no one worked for me, I don't know why :(. I have one div tag, which contains a script tag (from a website) and loads a kind of frame. That frame displays a monitor thanks to several variables, like the id (which is the most important). So, I want every 5 seconds, the id changes to display another monitor.
The problem is that in my refresh code I use the method load(), but in Firefox I get this warning "A call to document.write() from an asynchronously-loaded external script was ignored." and in chromium I get this one "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."
This is my code:
<script type="text/javascript">
var id = ["id1", "id2", "id3"];
var number;
var i = 0;
function change(){
if(i<id.length){
number = id[i];
i++;
}else if(i>=id.length){
clearInterval();
number = id[i];
console.log("start again");
}
return number;
}
function refresh(){
$('#midStag').load("myUrl" + ' #midStag');
}
setInterval(refresh, 5000);
</script>
<div id="midStag">
<script type="text/javascript">
//I only put the id because is the more important variable
//and the only one that I am changing
id = cambio();
/*more variables like width or height*/
</script>
<script type="text/javascript" src="http://dashboard.monitis.com/sharedModule/shareModule.js"></script>
I really need it, please. Any help I would appreciate that. If you don't understand something just tell it me and I'll correct. Thank you.