Loading Archives : Binary Bits https://blog.binarybits.net/tag/loading/ Bits & Pieces - A blog by Kannan Balasubramanian Tue, 18 Jul 2017 05:56:15 +0000 en-GB hourly 1 https://wordpress.org/?v=6.5.2 Load scripts in SharePoint within custom Javascript or Workflow https://blog.binarybits.net/load-scripts-sharepoint-within-custom-javascript-workflow/ https://blog.binarybits.net/load-scripts-sharepoint-within-custom-javascript-workflow/#respond Thu, 11 May 2017 05:08:03 +0000 https://blog.binarybits.net/?p=844 Following is the code which can be used to load JavaScript in sequence. This code for example loads the reputation.js from SharePoint’s layouts folder & jQuery from site assets. (function () { ExecuteOrDelayUntilScriptLoaded(function () { //sp.runtime.js has been loaded ExecuteOrDelayUntilScriptLoaded(function () { //sp.js has been loaded SP.SOD.registerSod('reputation.js', SP.Utilities.Utility.getLayoutsPageUrl('reputation.js')); SP.SOD.registerSod('jquery-3.2.1', '../SiteAssets/Scripts/jquery-3.2.1.min.js'); SP.SOD.loadMultiple(['reputation.js', 'jquery-3.2.1'], function () { […]

The post Load scripts in SharePoint within custom Javascript or Workflow appeared first on Binary Bits.

]]>
Following is the code which can be used to load JavaScript in sequence.

This code for example loads the reputation.js from SharePoint’s layouts folder & jQuery from site assets.

(function () {
    ExecuteOrDelayUntilScriptLoaded(function () {
        //sp.runtime.js has been loaded
        ExecuteOrDelayUntilScriptLoaded(function () {
            //sp.js has been loaded
            SP.SOD.registerSod('reputation.js', SP.Utilities.Utility.getLayoutsPageUrl('reputation.js'));
            SP.SOD.registerSod('jquery-3.2.1', '../SiteAssets/Scripts/jquery-3.2.1.min.js');
            SP.SOD.loadMultiple(['reputation.js', 'jquery-3.2.1'], function () {
                //reputation.js & jquery-3.2.1.min.js have been loaded.
                var context = SP.ClientContext.get_current();
                var web = context.get_web();
                //Check if jQuery has been loaded
                if (typeof jQuery != 'undefined') {
                    console.log("Jquery is loaded");
                }
                else {
                    console.log("Jquery is not loaded!");
                }
            });
        }, "sp.js");
    }, "sp.runtime.js");
})();

Source: https://sharepoint.stackexchange.com/questions/92082/uncaught-typeerror-cannot-read-property-get-current-of-undefined

The post Load scripts in SharePoint within custom Javascript or Workflow appeared first on Binary Bits.

]]>
https://blog.binarybits.net/load-scripts-sharepoint-within-custom-javascript-workflow/feed/ 0