Karaethon Posted January 7, 2019 Share Posted January 7, 2019 So I am following the w3schools AJAX toutorial to learn AJAX and I've got something wrong somewhere but I can't find it. The alert is my telltale, it won't fire unless I comment out the rest of the the function contents. Did I misread, mistype, or miscognate? <!doctype html> <html> <head> <script type = "text/javascript"> function clicked(){ alert("You clicked!"); var pidgin = new XMLHttpRequest(); pidgin.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("test").innerHTML = this.responseText; } }; pidgin.open("GET", "test.txt", true); pidgin.send(); } </script> </head> <body> <div id="test"></div> <a href="#" onclick="clicked();">click me</a> </body> </html> Link to comment Share on other sites More sharing options...
Karaethon Posted January 7, 2019 Author Share Posted January 7, 2019 Error Link to comment Share on other sites More sharing options...
Karaethon Posted January 7, 2019 Author Share Posted January 7, 2019 Ahh, there's a jQuery Ajax ability... jQuery does my heavy lifting for me... Shifting gears. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.