Send XML response back to AJAX request.

package WordPress
since 2.1.0

 Methods

WP_Ajax_Response()

WP_Ajax_Response($args = ''

Parameters

$args

PHP4 Constructor - Passes args to {@link WP_Ajax_Response::add()}.

__construct(string|array $args = '') : \WP_Ajax_Response
since 2.1.0
see

Parameters

$args

stringarray

Optional. Will be passed to add() method.

Returns

\WP_Ajax_Response

Append to XML response based on given arguments.

add(string|array $args = '') : string

The arguments that can be passed in the $args parameter are below. It is also possible to pass a WP_Error object in either the 'id' or 'data' argument. The parameter isn't actually optional, content should be given in order to send the correct response.

'what' argument is a string that is the XMLRPC response type. 'action' argument is a boolean or string that acts like a nonce. 'id' argument can be WP_Error or an integer. 'old_id' argument is false by default or an integer of the previous ID. 'position' argument is an integer or a string with -1 = top, 1 = bottom, html ID = after, -html ID = before. 'data' argument is a string with the content or message. 'supplemental' argument is an array of strings that will be children of the supplemental element.

since 2.1.0

Parameters

$args

stringarray

Override defaults.

Returns

stringXML response.

Display XML formatted responses.

send() 

Sets the content type header to text/xml.

since 2.1.0

 Properties

 

Store XML responses to send.

$responses : array

Default

array()
since 2.1.0
access private