Answer the question
In order to leave comments, you need to log in
How to work with BX.ajax.runAction correctly?
I'm trying to use Bitrix controllers for ajax request to my module via BX.ajax.runAction.
At the root of the module is .settings.php with the following content:
<?
return [
'controllers' => [
'value' => [
'namespaces' => [
'\\Petrov\\Main\\Controller' => 'mapi',
],
],
'readonly' => true,
],
];
<?
namespace Petrov\Main\Controller;
use Bitrix\Main\Engine\Controller;
class BasketActions extends Controller
{
public function configureActions()
{
return [
'getAnalogs' => [
'prefilters' => []
]
];
}
/**
* @param $arXmlId
* @return array
*/
public function getAnalogsAction($arXmlId)
{
return [];
}
}
BX.ajax.runAction('petrov:main.mpi.BasketActions.getAnalogs', {data:{}});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question