yandex
loader

please wait

  • Akansha Sinha Dec-28-2018 05:11:11 AM ( 2 months ago )

    How to load a script Dynamically ?

  • Vikrant Srivastava Dec-28-2018 07:58:24 AM ( 2 months ago )

    function loadScript(e)

    {

        if (e.preventDefault) {

            e.preventDefault();

        }

        

        if (!document.getElementById('ajax')) {

            var script = document.createElement('script');

            script.src='./ajax.js';

            script.id = 'ajax';

            //if we're adding a new script we need to wait for it to finish loading before

            //triggering the DOMContentLoaded event

            script.onload = triggerDOMContentLoadedOnScriptLoad;

            document.body.appendChild(script);

        }

Please login

Similar Discussion

Recommended For You