sometimes the message is appended multiple times, why?

sometimes the message is appended multiple times, why?

I built a chat using Jquery and Ajax. After calling Ajax, jQuery appends the last message in the chatboard. But I don't understand why sometimes he does it twice !! Not always, but just sometimes (especially if the browser is slow)... and I think the problem is only in multiple appending itself, because the message is NOT really inserted twice in the database. How can I solve this problem? Thank you very much, in advance.