So I was writing an A/B testing and was looking for the default jQuery method for loading an external script. So using the
jQuery.getScript, you can do exactly that; load a script after a web page is already loaded and perform actions once it is loaded into DOM.
[codepen_embed height=”353″ theme_id=”light” slug_hash=”qoBXxW” default_tab=”js,result” user=”fahdi” preview=”true” data-preview=”true”]See the Pen jQuery.getScript demo by Fahad Murtaza (@fahdi) on CodePen.[/codepen_embed]