JavaScript why there is no response on level 0,1 in ajax (onreadystatechange)

This is my code,i don't know why case 0, and case 1 are not working? are there any responses for these levels?

This is the output

  • request received
  • processing request
  • request finished and response is ready!

        var xhr = false;
        function checkAJAXSupport() {
            if (window.XMLHttpRequest) { 
              xhr = new XMLHttpRequest();
            } else if (window.ActiveXObject) {
              try {
				xhr = new ActiveXObject("Microsoft.XMLHTTP");
              } 
              catch (e) {
                try {
                  xhr = new ActiveXObject("Msxml2.XMLHTTP");
                } 
                catch (e) {}
              }
            }
         if (!xhr) {
              alert("your browser is very outdated!");
         
			  window.location.href = "http://www.google.com?q=download firefox";
            }
        }
		checkAJAXSupport();
		
 

		function sayHello(id, msg, time) {
			var target = document.getElementById(id);
			var text = document.createTextNode(msg);
			var br=  document.createElement("br");
			setTimeout(function() {
			target.appendChild(text);
			target.appendChild(br);	
			}, time)
			
		}
		
		
		xhr.open('GET','sidebar.html',true);
		var sec = document.getElementsByClassName('sec');
		xhr.onreadystatechange = function() {
			switch(xhr.readyState) {
				case 0: console.log("Request Not Initialized");break;
				case 1: console.log("Server connection Stablished");break;
				case 2: sayHello('ajax','request received',200);break;
				case 3: sayHello('ajax','processing request',400);break;
				case 4: sayHello('ajax','request finished and response is ready!',600);break;
			}
		}
		xhr.send();
<section id="sec" class="sec">
	<p id="ajax">
	</p>
</section>	
Answer:1

How can i draw only two images with reversing I don't know how to reverse. Pls help. var canvas = document.createElement('canvas'); canvas.width = 16 * scale; canvas.height = 32 * scale; ...

How can i draw only two images with reversing I don't know how to reverse. Pls help. var canvas = document.createElement('canvas'); canvas.width = 16 * scale; canvas.height = 32 * scale; ...

  1. horizontally flip image iphone
  2. horizontally flip image css
  3. horizontally flip image python
  4. horizontally flip image online
  5. vertical flip image
  6. vertical flip image python
  7. vertical flip image iphone
  8. vertical flip image online
  9. vertical flip image css
  10. vertical flip image matlab
  11. flip image horizontally photoshop
  12. flip image horizontally android
  13. flip image horizontally after effects
  14. flip image horizontally matlab
  15. flip image horizontally premiere
  16. flip image horizontally illustrator
  17. flip image horizontally html
  18. flip image horizontally powerpoint
  19. flip image horizontally java
  20. flip image horizontally opencv

I know that it's not the best approach to overwrite native JS API and I do it more for experiment. I would like to overwrite Promise resolve method handler to do some extra logic on each resolve. Is ...

I know that it's not the best approach to overwrite native JS API and I do it more for experiment. I would like to overwrite Promise resolve method handler to do some extra logic on each resolve. Is ...

I am attempting to dynamically create an object with name-value pairs using html input fields. This is what i have so far: var taskComplete = { newTask: function(arg) { var fieldObj = {}, ...

I am attempting to dynamically create an object with name-value pairs using html input fields. This is what i have so far: var taskComplete = { newTask: function(arg) { var fieldObj = {}, ...

  1. access dynamically created element jquery
  2. access dynamically created controls c#
  3. access dynamically-created-elements javascript
  4. access dynamically created text field with jquery
  5. c# access dynamically created textbox
  6. asp.net access dynamically created controls
  7. vb.net access dynamically created control

I tried to check if the input entered by a user is a number or not with the code below. It didn't work. var a = Number(prompt("Enter a number")); if (a !== NaN) { console.log("yes"); } else { ...

I tried to check if the input entered by a user is a number or not with the code below. It didn't work. var a = Number(prompt("Enter a number")); if (a !== NaN) { console.log("yes"); } else { ...

  1. check input number javascript
  2. check input number jquery
  3. check input number java
  4. check input number
  5. check input number c#
  6. check input number python
  7. check input number html
  8. check input number is armstrong or not
  9. check input number is perfect or not
  10. check number input js
  11. javascript check input number only
  12. jquery check input number only
  13. check input if number javascript
  14. check if input number is empty
  15. check if input number python
  16. php check input number
  17. bootstrap check input number
  18. check input is number or not in javascript
  19. bash check input number
  20. vuejs check input number