Friday, 25 July 2014

executeQueryAsync() not working in sharepoint hosted app

context.executeQueryAsync() not working in sharepoint hosted app
Root Cause: You might have created wrong "context"
Solution:
Try this code..

var clientContext = new SP.ClientContext.get_current();
var listCreationInfo = new SP.ListCreationInformation();
listCreationInfo.set_title("Welcome");
listCreationInfo.set_description("Hello welcome");
listCreationInfo.set_templateType(SP.ListTemplateType.contacts);
clientContext.get_web().get_lists().add(listCreationInfo);
clientContext.executeQueryAsync(ListCreationSuccess, failure);