Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript AJAX Basics (retiring) AJAX Concepts Introducing AJAX

matt thurmond
matt thurmond
8,743 Points

Is AJAX still relevant?

Hi! I'm wondering if learning AJAX is still relevant given that frameworks like React and Angular seem to handle this asynchronous server request-response functionality in a different way.

Since the course is long, it would be good to know if learning this is relevant in today's environment. Thanks!

2 Answers

AJAX is still relevant and very popular, but how you write it may change based on what libraries or frameworks are in the project. I almost never use the "raw" JavaScript way of writing it because jQuery makes it easier and is almost always already loaded into a project I'm working on. I'll also point out that despite what code-camps and web-dev courses make it look like, the vast majority of websites are not using React or Angular or any full-stack JavaScript framework: it's simply too much tool for the job. If all you need is some AJAX, putting an entire Node-based build process into your project is going to drive you nuts. Of course, if you ARE exclusively using one of those frameworks, then yeah, just learn how to do asynchronous API calls "their way." Good luck to you!

matt thurmond
matt thurmond
8,743 Points

Thanks, I'm realizing that web developers need to know a variety of ways of doing things and adjust their approach depending on the project scope and existing frameworks and libraries that are already implemented. It seems like a good baseline to know how to use both the Fetch API and XHR to handle requests and responses, and then I can expand on that by learning any framework specific approaches to this used by React, Angular, and other front-end frameworks.

Since I'm half-way through the AJAX course now, I'll definitely complete it.

Matt, I think that's an excellent approach. Good luck to you!

Brendan Whiting
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Whiting
Front End Web Development Techdegree Graduate 84,735 Points

The modern way is the Fetch API (Treehouse workshop here). Not all browsers have it, but there are polyfills for that. This isn't a React or Angular thing, it's a modern browser thing.

(Side note, modern Angular has the HttpClient which returns an Observable and operates a little differently than fetch).

If anyone reads this and wonders "which browsers don't have it?" the big one that matters is Internet Explorer (all versions). Here's the full breakdown.