Answer the question
In order to leave comments, you need to log in
How to include scripts and styles of an ajax-enabled component?
Hello. On the site, when the button is clicked, an ajax request is sent to the ajax.php file, which contains the connection of the prologue and the form component:
<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");?>
<?$APPLICATION->IncludeComponent(
"custom:forms",
"callMe",
Array(
"FORM_ID" => "callMe"
)
);?>
Answer the question
In order to leave comments, you need to log in
after a successful Ajax request in JS:
in res - server response with HTML, which also contains scripts
let processed = BX.processHTML(res, false); // парсим HTML
BX.ajax.processScripts(processed.SCRIPT); //выполняем найденные скрипты
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question