I've following issue. Function which supopse to create new item on the list, adds the row only when the list is situated in the root node (webUrl = "http://rootserver.com/";
) whereas when it is placed in different location the addition doesn't work (webUrl = "http://rootserver.com/cases/SLS/SLS-2015-00003/";
). Here is my function.
function createListItem(title,hours,server) {
//var webUrl = "http://rootserver.com/cases/SLS/SLS-2015-00003/";
//var webUrl = "http://rootserver.com/";
var webUrl = server;
var clientContext = new SP.ClientContext(webUrl);
//debugger;
var oList = clientContext.get_web().get_lists().getByTitle('TimeRegistration');
var itemCreateInfo = new SP.ListItemCreationInformation();
this.oListItem = oList.addItem(itemCreateInfo);
oListItem.set_item('Title', title);
oListItem.set_item('Hours', hours);
oListItem.update();
clientContext.load(oListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded_Create), Function.createDelegate(this, this.onQueryFailed));
}
Any ideas why is that?