I am going to update a small chat between two users every minute. This is already working – however I can’t figure how to do an AJAX call to update the DIV containing the actual messages.
var interval
window.onload = function(){
interval = setInterval('updateMessages()', 2000);
};
function updateMessages() {
$(function () {
// UPDATE #mail_container
});
}
What´d be a proper way approaching this?
The easiest way is probably to include jQuery and make use of either its .append() or .html() methods.
eg.
$("#mail_container").html("<p>Your chat message</p>");See: