Let's take for example the code below:
function createListItemProdus() {
var clientContext = new SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle('achizitii_produs');
var itemCreateInfo = new SP.ListItemCreationInformation();
this.oListItem = oList.addItem(itemCreateInfo);
oListItem.set_item('name', some_value);
oListItem.update();
clientContext.load(oListItem);
clientContext.executeQueryAsync(
Function.createDelegate(this, this.onQuerySucceededGol),
Function.createDelegate(this, this.onQueryFailed)
);
}
From what I've read on the Internet, the load
function loads the content of the list from the server to the client.
Then why do I use clientContext.load(oListItem);
after oListItem.set_item
?