I have data.js file with content:
var table=[];
table.push('10','11');
I want to use it in the other script, which looks like this:
var script=document.createElement("script");
script.src="http://xxxx/data.js";
document.body.appendChild(script);
setTimeout(function(){alert(table);},5000);
When i paste this to Firebug and run it, at the first time i got
function () {
[native code]
}
When i run this again i get what i wanted which is:
10,11
How can i achive this result at the first time i run this script?
alertis not a debugging tool, you should be using the console