Skip to content Skip to sidebar Skip to footer

Onreadystatechange Function Never Gets Called

Ok...so my code is very simple. The only problem is that the function to be called onreadystatechange is never getting executed. I put in an alert to display the readyState and the

Solution 1:

You need switch the calling order of xmlhttp.onreadystatechange and xmlhttp.open to make sure the onreadystatechange callback is registered before opening.

xmlhttp.onreadystatechange = function() {
  alert(xyz);
};
xmlhttp.open("POST", "http://localhost:8080/UsernameAvailability", true);

Post a Comment for "Onreadystatechange Function Never Gets Called"