I am new to ajax, and i am working on a class project.What I am trying to do/achieve is, to let that particular div to auto refresh. I know that there is alot of tutorials out there but most of it are using Jquery which i am not... So im not really sure how to implement the auto refresh option and how to automatically refresh it...
This is one of my code(ajax code)...
function message(clickedID){
var ID = clickedID;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("chatBox").innerHTML = xmlhttp.responseText;
}
};
xmlhttp.open("POST","retrieveMsg.php?q=" +ID,true);
xmlhttp.send();
}
Hopefully I can get an explanation on this and some examples Thanks in advance !