jQuery ajaxreadystate plugin

Today I’ve released a new open source library, so I figured what better time to post a new entry in my blog.

My latest open source contribution to the world is jquery-ajaxreadystate, a jQuery plugin which adds a new AJAX function with readystatechange capabilities, available for download on GitHub, NPM, and Bower.

The jQuery AJAX implementation is somewhat limited in that it does not provide a way of responding to the readystatechange events that fire during the AJAX request. The jQuery.ajax API documentation actually states the following.

No onreadystatechange mechanism is provided, however, since done, fail, always, and statusCode cover all conceivable requirements.

While this statement is true for most use cases, what if you want to access the response headers or status code before the entire request completes, or access the response body as it streams?

Evidently jQuery does not provide this functionality due to browser compatibility issues, so this plugin adds this extra functionality for browsers that support these features (see compatibility notes below).

This plugin works by adding a new method jQuery.ajaxreadystate method, which acts as a wrapper for jQuery.ajax, extending the functionality and updating the jqXHR object to remove the limitations and update properties as the readyState changes.

One thought on “jQuery ajaxreadystate plugin

  1. Pingback: Best Ajax Plugins | Best Jquery Plugins

Leave a Reply

Your email address will not be published. Required fields are marked *

Are you human? * Time limit is exhausted. Please reload the CAPTCHA.