javascript - SCRIPT src not loaded after append in to HTML using jQuery -
i developing application required load new html , append current page html.
now, loaded new html using jquery ajax in new loaded html have <script> display audio play. issue when script load script tag loaded html not display not loaded.
i used:
<script src="link of js file create audio" type="text/javascript"></script> above code not display / not loaded after append.
i append like:
var html = '<div> <h1>header</h1> <div>contain area</div> <script src="link of js file create audio" type="text/javascript"></script></div>' $("#container").append(html); but not working. 1 have idea in it.
thanks
you can use jquery getscript();
$.getscript( "url/for/script.js" ) .done(function( script, textstatus ) { console.log( 'script loaded' ); }) .fail(function( jqxhr, settings, exception ) { console.log( 'script not loaded' ); }); this append javascript file in script tags.
read more here.
Comments
Post a Comment