I have the following jQuery code in an iframe:
<script>
jQuery("#logBtn").click(function(){
jQuery("#content-promo").load("/path/to/file.php", function(response, status, xhr) {
if (status == "error") {
var msg = "Sorry but there was an error: ";
$("#error").html(msg + xhr.status + " " + xhr.statusText);
}else{ //update
$("html, body").animate({ scrollTop: 0 }, "slow");
}
});
return false;
});
</script>
How can the iframe scroll back to the top after the AJAX-request?