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

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -