function InsertResponseData(IsCorrect) {
try {
var context = new SP.ClientContext.get_current();
var web = context.get_web();
var list = web.get_lists().getByTitle("responseListName");
var listItemCreationInfo = new SP.ListItemCreationInformation();
var newItem = list.addItem(listItemCreationInfo);
newItem.set_item('QuestionID', json.d.Id);
newItem.set_item('Answer', selectedVaue);
newItem.set_item('Correct', IsCorrect);
newItem.update();
context.load(newItem);
context.executeQueryAsync(Function.createDelegate(this, this.success), Function.createDelegate(this, this.failed));
}
catch (e) {
alert('error:' + e.Message);
}
}
function success() { }
function failed(sender, args) { alert('failed.Message:' + args.get_message()); }
No comments:
Post a Comment