If you're using fbml, you can create and parse the element on the fly, see this answer for details:
How to add a Facebook "Like" button to an AJAX driven page
If you're using iframes, you don't need to build the url all over again, just refresh the iframe. For example, to refresh all the iframes on the page:
$("iframe").each(function(){
$(this).attr('src', $(this).attr('src'));
});