I'm making a chat app but it still needs one thing.It updates the messages every x seconds, but I need to make it so that it only checks for new messages every x seconds and only refreshes the post area div if there is new content.How do I achieve dat?For some reason the "textstatus notmodified" thing doesn't work.mail_getposts.php contains a while loop that fetches posts from the SQL table.
>>1549319i think that the "textstatus notmodified", refers to headers which are said from server when it's sending cache header and Last-Modified or ETag headers.refer to ifModified in https://api.jquery.com/jquery.ajax/On its own it doesn't know the page that is sent is different, you would need to set appropriate headers in the php script, for that you would need to have server side logic, which would remember what was already sent which is imho quite complicatedThe best would imho be to send new messages in json, and append them client side (that would make easy knowing stuff like timestamp of last message)if you insist on keep doing it with sending html, instead of refreshing with new content, first load existing messages and then have different php script with timestamp argument which is asked every X seconds if there were any new messages in last X seconds (i.e. newer than current time - X seconds) and if there are any, append them to the #postarea instead of replacing it (though with sending html without parsing it client side, you risk having duplicate or missed messages if they come near the X second threshold)
>>1549337>for that you would need to have server side logic, which would remember what was already sent which is imho quite complicatednevermind, that's stupidon second thought you can probably just set Last-Modified header to timestamp of last message