Plugins

The plugins site is currently in development.

We've been looking to provide a higher-quality, spam-free experience at the plugins site for some time, and a major error on our part forced us to shut down the current site before we could put the new one in place. We are developing a new site, and you can follow along with its development on GitHub. For more information about this transition, including steps you can take as a plugin author to prepare, please read our post about what's going on.

multi-part


mpAjax (multi-part Ajax responses)

A demo of this plugin can be found here: http://test.getify.com/mpAjax

Basically, put simply, this plugin extends (but is still backward compatible with) the core $.ajax functionality to allow automatic parsing of responses for a special syntax of "multi-part responses". If a response matches this format, the response will be split out and treated as multiple responses, each being called to the proper "success" handler. If the response doesn't "look" like multi-part, then it falls through and behaves exactly as normal.

You may ask, why do we need multi-part responses? There's a few intended use cases, but it comes down to needing/wanting to return multiple different "parts" of data (different types, etc) in a single response.
1. You need to return a block of HTML (without encoding/escaping it into JSON), and a separate JSON packet with data.
2. You need to return an HTML template and some JSON data separately, without any obfuscation/encoding/escaping of either.
3. You need to return some HTML, some JSON, and also some CSS, and handle all three types of data separately.
4. You need to return two or more different blocks of HTML, and need to handle each separately.

In all these cases, you could of course encode one type of data and inline it with the other type of data (encode HTML into a JSON property, or embed your JSON into a hidden input field in your HTML). But those methods are inefficient and make your responses more complicated and harder to parse and debug.