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> Quote Link to comment https://forums.phpfreaks.com/topic/308115-ajax-aduh/ Share on other sites More sharing options...
Karaethon Posted January 7, 2019 Author Share Posted January 7, 2019 (edited) Error Edited January 7, 2019 by Karaethon Error Quote Link to comment https://forums.phpfreaks.com/topic/308115-ajax-aduh/#findComment-1563336 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. Quote Link to comment https://forums.phpfreaks.com/topic/308115-ajax-aduh/#findComment-1563337 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.