\AjaxHTTPResponse
Special case of HTTP response that adds some helpers for ajax and automatically handles the construction of the response.
- Author: Mark Guinn <mark@adaircreative.com>
Synopsis
class AjaxHTTPResponse
extends SS_HTTPResponse
{
- // constants
- const EVENTS_KEY = 'events';
- const REGIONS_KEY = 'regions';
- const PULL_PARAM = '__regions__';
- const PULL_HEADER = 'X-Pull-Regions';
- // members
- protected array $events = ;
- protected array $regions = ;
- protected array $renderContexts = ;
- protected SS_HTTPRequest $request = NULL;
- // methods
- public void __construct()
- public $this triggerEvent()
- public $this pushRegion()
- public string getBody()
- public $this addRenderContext()
- public $this clearRenderContexts()
- public ViewableData|null getRenderContext()
- protected array getPulledRegionIDs()
Hierarchy
Extends
- SS_HTTPResponse
Constants
Name | Value |
---|---|
EVENTS_KEY | 'events' |
REGIONS_KEY | 'regions' |
PULL_PARAM | '__regions__' |
PULL_HEADER | 'X-Pull-Regions' |
Members
protected
- $events — array
- $regions — array
- $renderContexts — array
- $request — SS_HTTPRequest
Methods
protected
- getPulledRegionIDs() — Looks first for the X-Pull-Regions header and then for a __regions__ get/post var.
public
- __construct() — Create a new HTTP response
- addRenderContext()
- clearRenderContexts()
- getBody()
- getRenderContext()
- pushRegion()
- triggerEvent() — Queues up an event to be triggered on the client when the response is received.