Jump to content

AJAX - number value in a W3School example

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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...