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
Post a Comment