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) jQuery and AJAX Handling Errors

John Christensen
John Christensen
3,803 Points

Doesn't the .ajax method have the broadest applicability and make for the best practice when handing data requests, etc?

I am wondering if I should be spending time perfecting usage of .ajax or also learning other jquery ajax methods (.post, .getJSON, etc.) if .ajax can do what the others do. Thanks for your help!

2 Answers

Stefan Osorio
Stefan Osorio
16,419 Points

The shorthand methods uses less code, which is nice because it improves readability (if someone reads .getJSON they immediately know what is going on) and reduces opportunities for errors. But yes, you could use .ajax for everything.

John Christensen
John Christensen
3,803 Points

Thanks, Stefan! That makes sense to me.