SharePoint 2013 provides a JavaScript object model for use in either inline script or separate .js files. It includes all the same functionality as the .NET Framework and Silverlight client object models.
the JavaScript infrastructure for SharePoint 2013 interacts with the farm servers in batches. These batches always run asynchronously. In addition, it is now possible to access SharePoint data across domains in JavaScript.
The JavaScript object model is defined in a set of *.js files located at %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\TEMPLATE\LAYOUTS on each server.
Adding the item into the Sharepoint list
[javascript]
//--------------*******----Share Point 2013 Javascript COM-------**********
<script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.core.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.js"></script>
<script type="text/javascript">
var clientContext;
var oListItem;
var itemId;
var oList;
function createListItem() {
clientContext = new SP.ClientContext.get_current();
oList = clientContext.get_web().get_lists().getByTitle('Splessons');
var itemCreateInfo = new SP.ListItemCreationInformation();
this.oListItem = oList.addItem(itemCreateInfo);
var FirstName = "Sreehari";
var LastName = "Inukollu";
oListItem.update();
clientContext.load(oListItem);
clientContext.executeQueryAsync(
Function.createDelegate(this, this.onQueryInsertSucceeded),
Function.createDelegate(this, this.onQueryInsertFailed));
}
function onQueryInsertSucceeded() {
alert('Item Inserted: ');
}
function onQueryInsertFailed() {
alert("Item Insert Failed");
}
</script>
[/javascript]