SharePoint script on demand

Very old and exists in market from long time for SharePoint, So thought of summarizing it once.
1.     Create file with name ShareTechPoint.js and below content
function sayHello() {
//Notify SharePoint that the custom file has loaded.
SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs(“ShareTechPoint.js “);
2.     Now write the below code in another  HTML/ascx/aspx file

function runCode() {
SP.SOD.RegisterSod(‘ShareTechPoint.js ‘,

        var x = ExecuteOrDelayUntilScriptLoaded(sayHello, 
                              "ShareTechPoint.js ");

<input id=”Button1″ type=”button” value=”Run Code”

onclick="runCode()" />
This is how you can implement Script on demand for SharePoint.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s