$("#inboxanchor").replaceWith("<%=j render :partial => "layouts/inbox" %>"); $("#inbox-count").replaceWith("<%=j render :partial => "message_count" %>"); $("#inbox-<%= @message.id %>").fadeOut(800, "linear", function () { $(this).remove(); });