Здравствуйте
Как получить в class.php и ajax.php компонента массив переменной $arParams?
Версия Битрикса 18.1.7 и в нем нет метода getUnsignedParameters о котором везде говорится
template.php
ajax.php
Как получить в class.php и ajax.php компонента массив переменной $arParams?
Версия Битрикса 18.1.7 и в нем нет метода getUnsignedParameters о котором везде говорится
template.php
| Код |
|---|
var params=<?=\Bitrix\Main\Web\Json::encode(['signedParameters'=>$this->getComponent()->getSignedParameters()])?>;
var query = {
c: 'component:order',
action: 'test',
mode: 'class',
signedParameters: params.signedParameters
};
$.ajax({
url: '/bitrix/services/main/ajax.php?' + $.param(query),
method: 'POST',
data: data
}, function(response){
console.log(response);
}) |
ajax.php
| Код |
|---|
<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();
use \Bitrix\Main\Loader,
\Bitrix\Main\Engine\Controller;
class AjaxController extends Controller {
protected function listKeysSignedParameters() {
return [
'IBLOCK_ID', 'CART_PROPS'
];
}
public function configureActions()
{
return [
'test' => [
'prefilters' => []
]
];
}
public function onPrepareComponentParams($arParams) {
return $arParams;
}
public function testAction() {
return [
'params' => $this->getUnsignedParameters();
];
}
}
?> |