code: function loadScript(src, loadedCallback) {
      var script = document.createElement("script");
      script.setAttribute("type", "text/javascript");
      script.setAttribute("src", src);
  
      // Call the callback when the script is loaded.
      script.onload = loadedCallback;
      script.onreadystatechange = function () {
        if (this.readyState === "complete" || this.readyState === "loaded") {
          loadedCallback();
        }
      };
  
      head.appendChild(script);
    }
docs: Load a script into the page, and call a callback when it is loaded.
  
  @param {String} src The URL of the script to be loaded.
  @param {Function} loadedCallback The function to be called when the script is loaded.