Create a SharePoint page.
Add Content editor web part
Open notepad
Add below content
Upload in to SharePoint.
Copy the file location (URL)
Edit Content editor web part
Provide url which you get from above step in "Content Link" section.
Save.
Add Content editor web part
Open notepad
Add below content
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="//ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.js"></script> | |
<script type="text/javascript" src="/jquery-1.9.1.js"></script> | |
<script type="text/javascript" src="_layouts/15/sp.runtime.js"></script> | |
<script type="text/javascript" src="_layouts/15/sp.js"></script> | |
<script type="text/javascript"> | |
var oblName = "MyList"; | |
if (oblName) { | |
ExecuteOrDelayUntilScriptLoaded(loadList, 'sp.js'); | |
loadList(); | |
} | |
function loadList() { | |
getallItems(oblName); | |
} | |
function getallItems(oblName) { | |
var objClientCtx = new SP.ClientContext.get_current(); | |
var objTasklist = objClientCtx.get_web().get_lists().getByTitle(oblName); | |
var objQuery = SP.CamlQuery.createAllItemsQuery(); | |
this.objlistItems = objTasklist.getItems(objQuery); | |
objClientCtx.load(objlistItems); | |
objClientCtx.executeQueryAsync(onSuccess, onFail); | |
} | |
function onFail(sender, args) { | |
alert('Failed to get Tasks list items. Error:' + args.get_message()); | |
} | |
function onSuccess(sender, args) { | |
var objlistEnumerator = objlistItems.getEnumerator(); | |
while (objlistEnumerator.moveNext()) { | |
var objListItem = objlistEnumerator.get_current(); | |
$('#taskTitle').text(objListItem.get_item('Title')); | |
} | |
} | |
</script> | |
<div id="taskTitle"></div> | |
<div id="message"></div> |
Upload in to SharePoint.
Copy the file location (URL)
Edit Content editor web part
Provide url which you get from above step in "Content Link" section.
Save.