You should always wrap your XHRs in some kind of framework (one that you build yourself or one that someone has already built) which handles the icky details for you. jQuery is the most well known, but others are available as well, and it's not too difficult to build one yourself (though it's not worth the effort since there are fully functional, extremely well tested frameworks out there (like jQuery's .ajax)). The two primary reasons that you want to use a framework are to avoid code duplication and to ensure that your code is backwards compatible. In a modern web site you will make tons of Ajax requests, and if you write every one from scratch you'll be reinventing the wheel every time. As Bear's slide demonstrates, there are steps you'll have to take for every request -- adding a readystatechange listener, calling .send(), executing some code if the call succeeded (and presumably trying to parse the returned data if it's JSON; and that attempt should always be wrapped in a try-catch block), executing other code if the call failed, and adding a timeout listener (or using a polyfill if that event doesn't exist in the current browser). There's no point in rewriting that code every time since it's going to be the same. Also, whatever framework you use should handle any browser inconsistences for you (which means that you don't even have to be aware of them).
I second Bear's recommendation to always use JSON. Since Javascript is so loosely typed (a variable could be a number, object, function, or something else), many mistakes come from assumptions about the type of variables in your program. (Most of these mistakes are literally impossible to make in a strongly typed language like Java -- your code will be flagged instantly by the
IDE and it won't compile.) So pay very close attention to what type your variables are. I use JSDocs with Webstorm -- Webstorm flags function calls which are using variables of the wrong type, which makes it easier to catch mistakes -- though there are probably some free alternative IDEs which provide the same service.