Many modern websites — and practically all web apps — use a technique called Ajax to provide a smooth, fast experience for the user. From apps like Gmail and Google Maps through to JavaScript frameworks like jQuery Mobile, Ajax is a popular way to fetch data from a server in the background and update the page dynamically.
Writing Ajax JavaScript code from the ground up can be fiddly. However, many JavaScript libraries, including jQuery, have excellent high-level support for Ajax, making it easy for you to build Ajax-driven websites and apps with minimal hassle.
In this tutorial, you’ll learn the basics of making Ajax requests using jQuery. You’ll look at:
- Exactly what Ajax is, how it works, and why it’s a good thing
- How to make various types of Ajax requests using jQuery
- Sending data to the server along with an Ajax request
- Handling the Ajax response from the server, and capturing any data returned in the response
- How to customize jQuery’s Ajax handling and change default settings, and
- A few links to some more advanced Ajax-related info and tips.
To keep things simple, this tutorial concentrates on the JavaScript side of things, rather than delving into server-side coding. However, it’s pretty easy to write server-side scripts that work with Ajax. If you want to learn a server-side language, check out my PHP tutorials.
Ready to learn Ajax? Let’s get started!