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

Detailing AJAX best practices


Throughout this chapter, we've revisited the basics, and explored some of the techniques we can use to take our knowledge of AJAX to the next level – the key being that it is not necessarily just about coding, but visiting some of those tips and tricks that help make us a more rounded developer.

In Working with Deferreds and Promises section, we explored the basics of using jQuery's Deferreds and Promises, and how the change in architecture when using them can lead to significant improvements in performance. Before we round up this chapter, there are some additional best practices that we should follow wherever possible. Following list explains them:

  1. There is no need to call .getJson() or .get() directly. These are called when using the $.ajax() object by default.

  2. Don't mix protocols when calling requests. The preference is to use schemaless requests where possible.

  3. If you are just making GET requests, try to avoid putting request parameters in the URL – instead...