SEE MORE HEADLINES

function lastupdates(element){
let index = parseInt(document.getElementById(‘last_headlines_button’).getAttribute(‘index’))+1;
let total = document.getElementById(‘last_headlines_button’).getAttribute(‘total’);
let start = (index-1)*10;
let end = index*10-1;
let inner = “”;
let i = start;
fetch(‘https://prosportsoutlook.com/api_data/response_headlines.php?t=1664274644’)
.then(res=>res.json())
.then(res2=>{
for(;i<end;i++){
if(res2[i]){
let dateCr = res2[i].date_create;
let titling = res2[i].url!=''?'‘+res2[i].title+’‘:res2[i].title;
let newDate = moment(dateCr, “YYYY-MM-DD”).format(“MMM DD, YYYY”)
inner+=`

`;
inner+=`

${newDate}
${titling}

`;

inner+=`

`;
}
}
document.getElementById(‘load_more_last_headlines’).append(stringToHTML(inner));
});
if(index>=total){
document.getElementById(“last_headlines_button”).style.visibility = “hidden”;
}
document.getElementById(‘last_headlines_button’).setAttribute(‘index’,”+parseInt(index)+”);
}
var stringToHTML = function (str) {
var parser = new DOMParser();
var doc = parser.parseFromString(str, ‘text/html’);
return doc.body;
};

The post What Happened in Sports: September 9, 2021 appeared first on Pro Sports Outlook.



Source link