I literally just implemented this… like in the past hour or two. My code is going to be somewhat specific to the site I’m developing, but I’ll paste it here so hopefully you can adapt it to your needs…
mine is showing the list of favorites after deleting one, but it’s roughly the same deal to show it after adding one
html unordered list of favorites with “delete favorite” link:
<ul id="favorite-listings">
{exp:favorites:entries weblog="listings"}
<li id="favorite-{entry_id}">
<a href="http://{title_permalink=%27listings/details%27}" class="favorites-title">{title}</a> »
<a href="http://{title_permalink=listings/details}#reviews">review</a> |
<a href="http://{title_permalink=listings/details}#comments">comment</a> |
<a href="http://{path=" class="remove_from_favorites">remove</a>
(saved on {favorites_date format="%l, %F %j, %Y at %g:%i %a"})
</li>
{/exp:favorites:entries}
</ul>
javascript (jQuery) to perform ajax call, display message from the callback, remove the correct list item from the display, and update the count of favorites on the tab:
$(document).ready(function() {
$('.remove_from_favorites').bind('click', function() {
hideMessage();
var url = $(this).attr('href');
$('#page-content-message').load($(this).attr('href'), null, showMessage);
$('li:has(a[href="'+url+'"])').remove();
$('a[href="#fav-places"] > span').text('('+$('ul#favorite-listings > li').length+')');
return false;
})
});
function hideMessage() {
$('#page-content-message:visible').hide("slide", {direction: "up"}, 500);
}
function showMessage() {
$.scrollTo($("#page-content-message"), 500);
$('#page-content-message').show("slide", {direction: "up"}, 500);
}
hope that helps someone… YMMV
-Ty