I want to use the setInterval function to get the data from other website every 10s. But it can't repeat do it every 10s, just run the first time then stop.
setInterval(hypothes("testtest"), 10000);
function hypothes(username){
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4 && xhttp.status == 200) {
document.getElementById("demo").innerHTML = xhttp.responseText;
var Jsonfile= JSON.parse(xhttp.responseText);
console.log(Jsonfile.total);
console.log(username);
}
};
var url="https://hypothes.is/api/search?user=" + username + "&sort=created&order=asc";
xhttp.open("GET", url, true);
xhttp.send();
alert("test");
}