How do I load a script dynamically via Backbone?

This question already has an answer here:

  • JQuery to load Javascript file dynamically 2 answers
  • Dynamically load a JavaScript file 22 answers

  • Manually appending it:

    $('head').append('<script type="text/javascript" src="https://domain.com" id="hello" name="abc"></script>')
    
  • Using $.getScript :

    $.getScript('https://domain.com').done(function () {
        // loaded!
    });
    
  • RequireJS:

    require.config({
        paths: {
            "myscript": "https://domain.com"
        }
    });
    
    require(['myscript'], function () {
        // loaded!
    });
    
  • 链接地址: http://www.djcxy.com/p/42460.html

    上一篇: 如何链接到JavaScript文件中的JavaScript文件?

    下一篇: 如何通过Backbone动态加载脚本?