WP_Ajax_Response::__construct() WordPress Method

The WP_Ajax_Response::__construct() method allows you to create an AJAX response object. The object can be used to store data that will be sent back to the browser in JSON format.

WP_Ajax_Response::__construct( string|array $args = '' ) #

Constructor – Passes args to WP_Ajax_Response::add().


Description

Top ↑

See also


Top ↑

Parameters

$args

(string|array)(Optional) Will be passed to add() method.

Default value: ''


Top ↑

Source

File: wp-includes/class-wp-ajax-response.php

	public function __construct( $args = '' ) {
		if ( ! empty( $args ) ) {
			$this->add( $args );
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
2.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.