Skip to content

Instantly share code, notes, and snippets.

@ndv
Created July 18, 2012 18:43
Show Gist options
  • Save ndv/3137982 to your computer and use it in GitHub Desktop.
Save ndv/3137982 to your computer and use it in GitHub Desktop.
Loading JS API dynamically
window.ControlPanelJSLoaded = function() { EcwidCheckout.init({/* something */}); };
var script = document.createElement('SCRIPT');
script.src = "https://checkout.ecwid.com/controlpanel-api.js";
script.charset = "utf-8";
script.setAttribute("type", "text/javascript");
script.onerror = function() { alert('Could not load script'); };
document.body.appendChild(script);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment