AJAX and JSON

Now you know how to create webpages using HTML, and you know how to make them interactive using JavaScript. You also know how to use links between pages.


This is a companion discussion topic for the original entry at https://happycoding.io/tutorials/javascript/ajax

HI Kevin, I teach high school Intro Programming with Processing and Intro Web with Javascript and Node.js. I love your tutorials as they follow my curriculum almost exactly but with just enough difference to challenge the students to really understand. I was a real-time software engineer for about 20 years before becoming a teacher, and I like your emphasis on keeping things clean and simple. Too many students think if it looks complicated it is better! I still use the XMLHTTPrequest because the students can really see how the asynchronous functions work using concepts they already know. I think I will add fetch to my class this year, but after XMLHTTPrequest because it does seem like there is a lot of magical code in there.

1 Like

Thanks Clare!

Generally I absolutely agree with the benefit of showing how things work behind the scenes- that’s why I recommend folks learn JavaScript before learning React, for example. So I can definitely understand introducing XMLHttpRequest before the fetch() function.

If I was teaching a full JavaScript course, I might do exactly that. But I’ve found that if I’m just showing somebody how to do something, I usually stick with jumping straight to fetch(). On the other hand, if you start with XMLHttpRequest, students will definitely appreciate how much shorter fetch() can be!

Good luck with your class, and let me know how it goes!