Dhivakar Chelladurai
Dhivakar Chelladurai

Reputation: 108

Simple AJAX not working on Chrome

I've been trying to get this piece of AJAX program to run but it won't work on Chrome or Safari. It works on Firefox, though.

function myFunction() {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
        document.getElementById("myID").innerHTML =this.responseText;
      }
  };
  xhttp.open("GET", "myPage.php", true);
  xhttp.send();
}

Upvotes: 0

Views: 666

Answers (1)

Prasanna Hegde
Prasanna Hegde

Reputation: 96

Probably, It's the installed extensions that are messing it up!

Print the ready state and HTTP status code. You should be getting ready state 4 and status code 0 in chrome in this case.

Please read the answer by Lee in this post

Upvotes: 1

Related Questions