title: Scroll page to bottom not happening while changing window.location.href
body: <p>I have issue while trying to scroll page to bottom in ajax success. I am setting <code>window.location.href</code> as I need to remove the hash tag in url and then I want to scroll the page to bottom. But the page is still on top after page load. Below is my code.</p>
  
  <p>I know that scroll to bottom can be written after page reload outside ajax. But this particular requirement to scroll to bottom is not desired all the time and its based on a certain button click inside which ajax has been written.</p>
  
  <pre><code>    $.ajax({
              url: updatedUrl,
              dataType: 'json',
              type: 'post',
              data: 'id=' +  id,
              complete: function() {},
              success: function(data) {
                  window.location.href = window.location.href.split('#')[0];
                  $('.overlay').hide();
                  var $target = $('html,body'); 
                  $target.animate({scrollTop: $target.height()}, 1000); 
              },
              error: function(xhr, ajaxOptions, thrownError) {
                  alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
              }
      });
  </code></pre>
  
  <p>What might be the issue here? How can I remove the hash tag as well as scroll page to bottom? </p>