javascript - Append script to page using jquery -


i receive on data (after ajax call) 2 script tags, data this:

var scripts = $(data).filter('script');     

now want append content of 2 script tags div. how can this?

for(var i=0; < scripts.length; i++) {     $('#mydiv').append(scripts[i]); } 

the above approach doesn't append anything.

i can't reconstruct scripts in js (i've seen approach in other posts) because scripts contain loads of elements , logic.

try this:

function codegenerate(code){     var js= document.createelement('script');     js.text= code;     document.body.appendchild(js); } 

Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -