i'm trying add external javascript code with this code:
function get_js(b){
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = b;
head.appendChild(script);
}
This external javascript code using document.write inside:
document.write('<script language="JavaScript">document.write(\'<div id="something" style="position: fixed; top: 0; bottom: 0; left: 0; right: 0;"> <\/div>\');...
When i'm trying execute function from this file, i'm getting this error:
ReferenceError: some_function is not defined
I thought that document.write in JS code is problem. Can anybody help me?
Thanks in advance!
///
OK, figured it out with POSTSCRIBE: https://github.com/krux/postscribe