Jump to content

AJAX - number value in a W3School example


redmellow

Recommended Posts

Yes I'm a newbie in AJAX '&&' JavaScript.

 

As I'm a pupil here, I find hurdle almost in any code...

 

There is an AJAX code with some number value in it, like 4 - 200, but I can't understand the nature of this digits or what they are indicating...

function loadDoc() {  var xhttp;  if (window.XMLHttpRequest) {    // code for modern browsers    xhttp = new XMLHttpRequest();    } else {    // code for IE6, IE5    xhttp = new ActiveXObject("Microsoft.XMLHTTP");  }  xhttp.onreadystatechange = function() {    if (xhttp.readyState == 4 && xhttp.status == 200) {      document.getElementById("demo").innerHTML = xhttp.responseText;    }

You see: "== 4 && xhttp.status == 200)" ... what for?

 

Thanks to anyone who'll reply to this 'double-dumb' question!!

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...