Bitrix Ajax how to display a notification after submitting a form?

  • 0
    There is a code like this:
    <?=CAjax::GetForm('method="POST"', 'action="/mail.php"', $arResult["AJAX_ID"], '1')?>
    <input type="hidden" name="ajax" value="Y">
    <input type="hidden" name="js" id="jstext" value="N">
    <div class="modal-body" id="<?=$arResult["AJAX_ID"]?>">
    <?if ($_POST["FB_SUBMIT_".$arResult["AJAX_ID"]] && $_POST["ajax"] == "Y"):
        <?if (count($arResult["ERRORS"]) > 0):?>
            <div class="alert alert-error">
                <button type="button" class="close" data-dismiss="alert">&times;</button>
                <p>- <?=implode("<br>- ",$arResult["ERRORS"])?></p>
        <?elseif ($arResult["OK"]):?>
            <div class="alert alert-success">
                <button type="button" class="close" data-dismiss="alert">&times;</button>

    below it, the form fields themselves are displayed. The form works and the letters arrive without any problems, but there is no notification whether the letter is gone or not. In the browser console, it outputs the following when the button is clicked:
    TypeError: Error in invocation of runtime.sendMessage(optional string extensionId, any message, optional object options, optional function responseCallback): chrome.runtime.sendMessage() called from a webpage must specify an Extension ID (string) for its first argument. 
    kernel_main_v1.js?1596206376311659:23 Uncaught TypeError: Cannot set property 'innerHTML' of null
        at HTMLFormElement.t.BXFormCallback (kernel_main_v1.js?1596206376311659:23)
        at HTMLFormElement.a.ajax._submit_callback (kernel_main_v1.js?1596206376311659:23)
        at HTMLIFrameElement.<anonymous> (kernel_main_v1.js?1596206376311659:15)

    Doesn't return $ arResult ["OK"].
    What could be wrong and what to do about it?
    AJAX William Grant, Oct 18, 2019

  • 0 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!