I am trying to get the time and date a SharePoint list was last modified. The code to call the date and time will live on a different SharePoint page. I've thrown the code below together based on bits and pieces found online. CurrentTimeFrame is the list name I need to call the information for. This code doesn't work, but I couldn't tell you why. Openly admit I am not much of a JavaScript person. Any pointers (aside from learning the language - which I'm working on)? Help is very much appreciated.
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
var timeFrameRequestUrl = _spPageContextInfo.webAbsoluteUrl +
"/_api/web/lists/getbytitle('CurrentTimeFrame')/items";
$.ajax({
url: timeFrameRequestUrl,
method: "GET",
headers: {
accept: "application/json;odata=verbose"
}
}).done(function (response) {
console.log(response);
document.write("Last updated on ")
document.write(lastModified() + " @ " + GetTime());
document.write(" [D M Y 24 Hour Clock]")
document.write("");
});
})
})
</script>