SP.ClientContext.load method (sp.js)
Retrieves the properties of a client object from the server.
Applies to: apps for SharePoint | SharePoint Foundation 2013 | SharePoint Server 2013
SP.ClientContext.load(clientObject)
Parameters
- clientObject
SP.ClientObject
The object that contains the properties to retrieve from the server.
Remarks
The load method is inherited from the SP.ClientRuntimeContext object.
Example
The following code example shows how to use the load method.
function retrieveWebSite(siteUrl) {
var clientContext = new SP.ClientContext(siteUrl);
this.oWebsite = clientContext.get_web();
clientContext.load(this.oWebsite);
clientContext.executeQueryAsync(
Function.createDelegate(this, this.onQuerySucceeded),
Function.createDelegate(this, this.onQueryFailed)
);
}
function onQuerySucceeded(sender, args) {
alert('Title: ' + this.oWebsite.get_title() +
' Description: ' + this.oWebsite.get_description());
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() +
'\n' + args.get_stackTrace());
}
See also
Other resources
Complete basic operations using JavaScript library code in SharePoint 2013