Book Image

Mastering jQuery

By : Alex Libby
Book Image

Mastering jQuery

By: Alex Libby

Overview of this book

<p>Mastering jQuery has been written not only to help maximize your skills with core functionality in the library, but also to explore some of the more intriguing ways of using the library to achieve real-world solutions that could feature on any website or online environment.</p> <p>You'll start with a look at some of the more advanced ways to incorporate the library into your pages, followed by working with forms and advanced form validation using regular expressions. Next you'll move on to animating in jQuery, advanced event handling, and using jQuery effects.</p> <p>Finally, you will develop practical examples of using jQuery with external functionality such as node-webkit, before finishing with a session on optimizing your version of the library for maximum efficiency and exploring best practices for using QUnit.</p>
Table of Contents (21 chapters)
Mastering jQuery
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 5. Integrating AJAX

A question – what do Deferreds, Promises, and /ˈeɪdʒæks/ have in common?

The answer is simple – for at least two of them; they are utilities that work with AJAX; the third is actually the International Phonetic spelling of AJAX.

Throughout the history of the Internet, we as end users were forced to endure page refreshes – you had to force a page refresh to show new content. Not so now – we can refresh content without needing to clear the page, using the power of AJAX, but not without its issues. Enter Deferreds and Promises – not for beginners, but a useful tool once you understand how it works!

Over the next few pages, we'll look at a number of topics relating to the use of AJAX with jQuery. These would include:

  • Detailing AJAX best practices

  • Improving the speed of loading data with static sites

  • Using callbacks to handle multiple AJAX requests

  • Enhancing your code with jQuery Deferreds and Promises

  • Seeing Deferreds and Promises in action

Let's get stuck in…!