This article explains how to write code to perform basic operations using the JavaScript client object model in SharePoint 2013.
You can use the SharePoint client object model to retrieve, update and manage data in SharePoint 2013. SharePoint makes the object model available in several forms.
This article shows how to do basic operations using the JavaScript object model. You can add a reference to the object model using HTML <script> tags.The following sections describe tasks that you can complete programmatically and they include JavaScript code examples that show the operations.To create files, you use a FileCreationInformation object, set the URL attribute and append content as a base64 encoded array of bytes, as shown in this example.Procedure
Open your SP Site in SharePoint 2013 Designer, then select Site Assets icon in the designer ribbon and add a JavaScript file.Figure 1: Add a JavaScript FileAfter adding a JavaScript file, this file will be available in the SharePoint Site Assets Folder.Figure 2: Site Assets FolderGo to the SP site Page and add a new page to the SharePoint site.Figure 3: SP Site Figure 4: Add a New PageAfter adding a page select an Insert button in the Ribbon Menu.Figure 5: Ribbon MenuThen add a Content Editor Web part into the page.Figure 6: Content EditorEdit the WebPart and add a JavaScript file link to the content link .Figure 7: Web PartSave the web part and save the page in the site. Click the button!Figure 8: Save the web PartFigure 9: list updated succesfullyList updated successfully.Source Code
SharePoint Framework (SPFx) A Developers Guide