I am site administrator for one of the SharePoint site and trying to get all the lists name of SharePoint 2013 site using JSOM and Html. And i had created 2 files one html and other js file in Site Assets,And linked the html file location in CEWP but found no luck can any one help me in knowing what went wrong in my code
HTML Code
<head>
<meta charset="utf-8" />
<title></title>
<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" src="../Shared Documents/GetRestitems.js"></script>
</head>
<body>
<div id="divhelloworld">You Will Get the Data</div>
</body>
</html>
JS Code
$(document).ready(function(){
function getListData() {
var clientContext = new SP.ClientContext();
var oWebsite = clientContext.get_web();
this.collList = oWebsite.get_lists();
clientContext.load(collList);
clientContext.executeQueryAsync(
Function.createDelegate(this, this.onQuerySucceeded),
Function.createDelegate(this, this.onQueryFailed)
);
}
function onQuerySucceeded() {
var listInfo = '';
var listEnumerator = collList.getEnumerator();
while (listEnumerator.moveNext()) {
var oList = listEnumerator.get_current();
listInfo += 'Title: ' + oList.get_title() + ' - Created: ' +
oList.get_created().toString() + '<br />';
}
$("#divhelloworld").html(listInfo);
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() +
'\n' + args.get_stackTrace());
}
});