SO I am trying to call pushstate method within my JavaScript Ajax function but it doesn't code is:
HttPRequest.onreadystatechange = function() {
if(HttPRequest.readyState == 3) // Loading Request {
document.getElementById("listarticles").innerHTML = '<img src="images/spiral.gif" align="center" />';}
if(HttPRequest.readyState == 4 && HttPRequest.status == 200) // Return Request {
var response = HttPRequest.responseText;
document.getElementById("pagetitle").innerHTML = 'New Articles';
document.getElementById("listarticles").innerHTML = response;
window.history.pushState(newarticle,'New Articles','newarticles');}
}
The ajax response is printed on the screen fine but the pushstate doesn't work because my url doesn't change. any knows what is my problem? Lastly this function is also called when the page is loaded for the first time.