Make the div viewr's position to fixed. like so:
#viewr{
width:30em;
height:18em;
border: 1px solid #ccc;
background-color: #f3f3f3;
display:none;
}
use whatever class you want to style it
Now add this function in the jquery, this will make the appear on the center of the screen:
jQuery.fn.center = function () {
this.css("position","absolute");
this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) +
$(window).scrollTop()) + "px");
this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 2) +
$(window).scrollLeft()) + "px");
return this;
};
Now in your success function do the following to make it visible and invisible after some time:
success: function(html){
$('#viewr').html(html);
$('#viewr').fadeIn('slow').center().delay(2000).fadeOut('slow');
}
Do not use append(), that will always append the html in the div.
The delay amount is in milliseconds, so set it to whatever you require.
This should do the trick