I have the following code in my SharePoint 2013 app, I'm getting no errors but the item is not being added, anyone spot anything eyes are square from looking!
function addListItem() {
this.web = ctx.get_web();
this.List = this.web.get_web().get_lists().getByTitle('ListName');
var itemCreateInfo = new SP.ListItemCreationInformation();
this.ListItem = this.List.addItem(itemCreateInfo);
this.ListItem.set_item('Title', 'This is my test holiday title!');
this.ListItem.set_item('StaffName', 'Joe Black');
this.ListItem.update();
this.ctx.load(this.ListItem);
this.ctx.executeQueryAsync(
Function.createDelegate(this, this.onQuerySucceeded),
Function.createDelegate(this, this.onQueryFailed)
);
}
function onQuerySucceeded() {
alert('Item created: ' + ListItem.get_id());
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() +
'\n' + args.get_stackTrace());
}
TIA