I would like to know is there any best way to create realtime data checker from page to backend like for example PHP to MySQl aside from sending an Ajax every 5 seconds using these lines of code.
setInterval(function(){
$.ajax({
url: "url",
type: "post",
data: {sys_id: <some id>},
success: function(returnedValue){
`some dom manipulation here`;
}
})
},5000);
Note that this is just a sample ajax execution.