I'm trying to get a .PHP file to run from a .JS file when the JS file runs (and loops every 4 seconds). The code below does not work. I'm wondering if its to do with file linking in WordPress? I'm very new to JS but doing my best to learn.
$(document).ready(function(){
setInterval(function() {
alert("Database updated");
var xhttp = new XMLHttpRequest();
xhttp.open("GET", "tb-user.php", true);
}, 4000);
});