Callbacks are the cornerstone of JavaScript since it is single-threaded in nature. This can quickly turn into spaghetti code when handling multiple, dependent AJAX calls. Enter Promises! Deferred and promise are part of jQuery since version 1.5 and they help in handling asynchronous functions like AJAX.
Sending Request Headers via jQuery AJAX
Ever wanted to send request headers from jQuery instead of the “code-behind”? You can easily tweak the ajaxSetup object to do this.
Polling AJAX Requests in JavaScript
Polling AJAX is tricky. If the next interval triggers before the last AJAX request is complete, your app is doomed!! This creates a domino effect where your queue for requests fill up faster then it can complete. Your queue will NEVER finish… similar to an infinite loop.