Skip to content

Instantly share code, notes, and snippets.

@tesfayegari
Last active February 1, 2020 17:11
Show Gist options
  • Save tesfayegari/57ea4dbe139e2b54ac3c35411f0804c5 to your computer and use it in GitHub Desktop.
Save tesfayegari/57ea4dbe139e2b54ac3c35411f0804c5 to your computer and use it in GitHub Desktop.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<div class="container-fluid">
<div id="myItems">
</div>
</div>
<script>
//Function to get list items by passing List name to the list
function getItems(listName) {
var url = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('" + listName + "')/items";
return $.ajax({
url: url,
method: "GET",
headers: { "Accept": "application/json; odata=verbose" }
});
}
function getLists() {
var url = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists?$filter=Hidden eq false";
return $.ajax({
url: url,
method: "GET",
headers: { "Accept": "application/json; odata=verbose" }
});
}
//jQuery document ready, the code in the block runs after html renders
$(document).ready(function () {
//Code inplementation goes here
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment