Reputation: 11374
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?
Upvotes: 0
Views: 182
Reputation: 1166
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:
Upvotes: 1