make sure your window.location =newlocation is execute after completing your ajax request may be your ...
stackoverflow.com