Client object model inside LMFConfig.js

May 24, 2012 at 5:20 AM

Hi ,

Do you know why i am always getting  SP.ClientContext is null or not an object  javascript error  when ever i am trying to  intialize SP.ClientContext.get_current

var clientContext = SP.ClientContext.get_current();   

var DLRList = clientContext.get_web().get_lists().getByTitle('MyList');

 

Vijay

Coordinator
May 24, 2012 at 7:24 AM

Hello,

the jQuery document ready function is called before the client object model JavaScript. To solve this issue simply use the method below:

ExecuteOrDelayUntilScriptLoaded(ExecuteMyCode, "sp.js");


 The method you want to call is the "ExecuteMyCode". You can name it as you want.

 

Have a nice day,

Patrick