I am creating a messaging system and I am currently reloading the contents of a div containing messages every 10 seconds using jQuery .load()
, but I have a problem: when I try to make the βSelect Allβ button, Delete Selected, etc. ., When it comes 10 seconds, it reloads the buttons and reloads the messages, so the messages become unavailable due to a reboot.
What I would like to know is how to make it load in new messages, but not reload the entire div. I know that Gmail does not reload the entire div because it works correctly.
This is my JavaScript function that reloads the div and changes the page title (incoming message counter), so it remains updated:
function title() { setTimeout("document.title = $('#heading').text();", 500); } function ajaxStuff() { setTimeout("$('#heading').load('/employee/message/inbox.php #h1_head'); $('#messages').load('/employee/message/inbox.php #messages_inner');title();ajaxStuff();", 10000); } ajaxStuff();
This is how I set up the mailbox:
Basically what I want to do is upload to new posts using AJAX, but somehow not refresh the div. I tried to take a look at the source of Gmail, but there is too much to go through, and they are confused with a bunch of random classes and identifiers.
Note. I searched this on Google for a while and found nothing.
source share