domatskiy / bitrix-ajax-response
v1.4.0
2017-10-29 08:04 UTC
Requires
- php: >=5.6.4
Requires (Dev)
- phpunit/phpunit: ^5.4.0
This package is not auto-updated.
Last update: 2025-03-30 04:48:28 UTC
README
Установка
composer require domatskiy/bitrix-ajax-response
использование Closure
new AjaxResponse(function(){ ... });
использование метода класса
new AjaxResponse('class@method');
Использование старого bitrix api
Важно: в запросе нужно передавать поле 'ajax' со значением 'Y'
new AjaxResponse('class@method', true);
Пример
define("STOP_STATISTICS", true); define('NO_AGENT_CHECK', true); define("STATISTIC_SKIP_ACTIVITY_CHECK", true); use Domatskiy\AjaxResponse; # подключаем bitrix require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php"); if(class_exists('\Domatskiy\AjaxResponse')){ new AjaxResponse(function(){ $result = new AjaxResponse\Result(); $data = array(); # body $result->setData($data); return $result; }); }