Scroll to top after Ajax content load

Just use the scroll function

scrollTo(0);

If you want the jquery, then here is a good example with smoothing :)

From the link:

$('html, body').animate({ scrollTop: 0 }, 0);
//nice and slow :)
$('html, body').animate({ scrollTop: 0 }, 'slow');

To put it in your code

...
        success: function (msg) {
            $("#view-area").html(msg);
            $("#loader").fadeOut();
            //Put code here like so
            $('html, body').animate({ scrollTop: 0 }, 0);
        }

All ajax requests have a callback argument so use scrollTop(0). Check the jQuery documentation on how to use ajax callbacks.


You can do $(window).scrollTop(0);