i’m displaying entry’s from my MySQL db to a page using J query .load()
and with set Interval i’m refreshing the results every second, as a part of a messaging/chat system i’m working on.
now, on the same page i have an option to add a MSG to the db, so it works fine and the message gets displayed, what i want to do is to slide down the message i just sent.
i managed to do that using:
$i++;
inside a while loop setting a class for the message where $i == 1; but because of the results keep refreshing it keeps sliding down all the time and slides down with first page load and not only when new message is sent.
can some one please help me with a good solution?
what seems that u want are using a common div for both the msg submit and the result display to be refreshed every time and slide down . you should use separate div for the results and use
.load()on it and use seperate div for the msg submit, so that both does not slide down when interval happens . for eg use<div class="msg_submit"></div>for msg submit content and use<div class="results"></div>for results and use$('.results').load('path');hope it helps 🙂