Continuation object

jmarnold edited this page Jul 7, 2012 · 3 revisions

What is it?

The continuation object is a data structure that represents server-side responses to JSON Ajax requests. The data structure is designed to be standardized between the client and the server.

How does that work?

The continuation object defines several common properties. These properties are sent down by the server and processed by jquery.continuations. When the clientside continuation is created, it merges the server-sent properties into a common continuation object.

The common client-side continuation is designed to be extended. That is, you can define properties in addition to the baseline properties. The continuation is made public to allow for prototype usage via:

$.continuations.continuation.prototype.myCustomFunction = function() { };

What are the common properties?

The common properties returned from the server are: { success: false|true, message: '', refresh: false|true, errors: [] }

Additional properties

When the continuation is transformed, the following properties are added: { statusCode: (200, 301, 500, etc.), response: (jQuery XHR object) }