Correct AJAX Use

Hello,

I am using AJAX to display the contents of a mailbox. Clicking on Older
or Newer should be showing the older or newer messages, without
refreshing the page. The logic works, but the new information gets
displayed along with the old information. Do I need to clear the old
output from the screen first? And if I do, how do I do it?

Here is a pastie that provides the information about the code:
http://pastie.caboo.se/27605

Any help is much appreciated.

Sounds like you are appending instead of rewriting, which looks to be caused by the :position => ‘top’ param sent to :url. Remove that and see what happens.

Jason

I don't know how it could have been that simple. I spent HOURS on it
yesterday. At one point, I did remove that reference, but I guess
something else broke, and after tinkering for such a long time, it made
it back.

Thank you VERY much for this simple yet very effective solution.