• Модуль: vote
  • Путь к файлу: ~/bitrix/modules/vote/lib/base/controller.php
  • Класс: BitrixVoteBaseController
  • Вызов: Controller::sendJsonResponse
protected function sendJsonResponse($response, $params = null)
{
	if(!defined('PUBLIC_AJAX_MODE'))
	{
		define('PUBLIC_AJAX_MODE', true);
	}

	global $APPLICATION;
	$APPLICATION->restartBuffer();

	if(!empty($params['http_status']) && $params['http_status'] == 403)
	{
		header('HTTP/1.0 403 Forbidden', true, 403);
	}
	if(!empty($params['http_status']) && $params['http_status'] == 500)
	{
		header('HTTP/1.0 500 Internal Server Error', true, 500);
	}
	if(!empty($params['http_status']) && $params['http_status'] == 510)
	{
		header('HTTP/1.0 510 Not Extended', true, 510);
	}

	header('Content-Type:application/json; charset=UTF-8');
	echo Json::encode($response);

	$this->end();
}