Undefined is not a function SP.clientcontext RRS feed

  • Question

  • I am having a hard time trying solving this simple thing. I learned that in order to load sp.js to have the client context, I need to wait until the page loads everything. So this is my code: 

    var context = new SP.ClientContext(); 
    	//code goes here

    But am getting this error: undefined is not a function for SP. So what I read is that I need to do it like this:

    $(document).ready(function () { SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function () {

    }); });

    but this also didn't work. any suggestions would be great

    Saturday, July 4, 2015 2:27 AM


  • Use: ExecuteOrDelayUntilScriptLoaded instead, like this:

    your stuff here

    Mohamed Derhalli

    SharePoint Consultant

    Blog: SharePoint Thoughts    Twitter:    LinkedIn:   

    • Marked as answer by Deborah Xa Tuesday, July 21, 2015 8:14 PM
    Saturday, July 4, 2015 10:23 AM