How to update item from JSOM REST call using jquery write down the code?
The other answer is incomplete. UpdateQueryAsync was missing which does the actual write opration on the server. Below is complete piece of code.
function UpdateItem() {clientContext = new SP.ClientContext.get_current();oList = clientContext.get_web().get_lists().getByTitle(‘ListName’);
this.oListItem =oList.getItemById(1);
oListItem.set_item(‘Title’, ‘My Updated New Title’);
oListItem.update();
clientContext.load(oListItem);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQueryInsertSucceeded),Function.createDelegate(this, this.onQueryInsertFailed));}
function onQueryInsertSucceeded() {alert(‘Item Updated: ‘);}
function onQueryInsertFailed() {alert(“Item Update Failed”);}
function updatelistitem() { var clientContext = new SP.ClientContext(https://****.sharepoint.com/sites/demo"); this.oListItem = oList.getItemById(3); var oList = clientContext.get_web().get_lists().getByTitle('Announcements'); oListItem.set_item('Title', 'My Updated Title'); oListItem.update();}
function updatelistitem() {
var clientContext = new SP.ClientContext(https://****.sharepoint.com/sites/demo");
this.oListItem = oList.getItemById(3);
var oList = clientContext.get_web().get_lists().getByTitle('Announcements');
oListItem.set_item('Title', 'My Updated Title');
}