Hi,
i have a SharePoint list that i would like to have the word 'New' appended to the most recent Announcement items(Say the 1st and the 2nd items will have new appended while the rest will display as they are). But i'm not sure how to achieve this.
Any help?
var glblognews = function getBlogItems () {
// execute AJAX request
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/Blog/_api/web/lists/getbytitle('Posts')/items?$select=Title,ID,PostCategory/Title,PostCategory/ID&$expand=PostCategory&$filter=PostCategory/Title eq 'General'",
type: "GET",
headers: { "ACCEPT": "application/json;odata=verbose" },
success: function(data) {
console.log(_spPageContextInfo);
var items = "";
var posturlLink= "";
var posturl = _spPageContextInfo.webAbsoluteUrl + "/Blog/Lists/Posts/Post.aspx?ID=";
var categoryurl = _spPageContextInfo.webAbsoluteUrl + "/Blog/Lists/Categories/Category.aspx?CategoryId=";
//console.log(categoryurl);
$.each(data.d.results, function(key, value) {
posturlLink = '<li>' + '<a href="' + posturl + value.ID + '" >' + value.Title + '</a><p><span></li>';
$("#announcementsItems").append(posturlLink);
});
$(document).ready(glblognews());
thanks