PHP code example of baruchyan / bitrix-ajax

1. Go to this page and download the library: Download baruchyan/bitrix-ajax library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

baruchyan / bitrix-ajax example snippets


namespace App\Ajax\Catalog;

use Baruchyan\BitrixAjax\BaseAjax;


/**
 * Class Params
 * @package App\Ajax\Catalog
 */
class Params extends BaseAjax
{

    /**
     *  Пример Action setParams
     */
    protected function setParamsAction(): void
    {

    
        $params = $this->request->get('params');
        
        $this->setField('count', 10);

        $this->setSuccessStatus();
    }

}

'status' => false, // статус true/ false
'message' => '', // сообщение 
'errors' => [], // массив ошибок 
'fields' => [] // массив дополнительных полей ответа