javascript - First AJAX example won't run -


i have started working way through ajax tutorial on w3schools website , first example won't run. why won't run please? opens in browser nothing happens when click button.

the tutorial url;

https://www.w3schools.com/js/tryit.asp?filename=tryjs_ajax_ie

here html page created in notepad++

<!doctype html> <html> <body>  <h1>the xmlhttprequest object</h1>  <p id="demo">let ajax change text.</p>  <button type="button" onclick="loaddoc()">change content</button>  <script>   function loaddoc() {   var xhttp;   if (window.xmlhttprequest) {   // code modern browsers     xhttp = new xmlhttprequest();     } else {     // code ie6 , ie5     xhttp = new activexobject("microsoft.xmlhttp");  }   xhttp.onreadystatechange = function() {   if (this.readystate == 4 && this.status == 200) {     document.getelementbyid("demo").innerhtml = this.responsetext;  } };  xhttp.open("get", "ajax_info.txt", true);  xhttp.send(); } </script> </body> </html> 

i run html page selecting run >> chrome in notepad++ (but tried firefox , ie too). ajax_info.txt file in same location html file. here contents;

ajax not programming language.

ajax technique accessing web servers web page.

ajax stands asyncronous javascript , xml.

because of typo xhhtp instead of xhttp.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -