Answer the question
In order to leave comments, you need to log in
Bitrix: feedback form on AJAX. Why is there no result in the server response?
I'm making a form in a popup window without reloading.
On click, I send a POST request, I catch it in the template:
if($_POST['FEEDBACK_AJAX'] === 'Y') {
$APPLICATION->RestartBuffer();
header('Content-type: application/json');
echo json_encode(array(
'arResult' => $arResult
));
die();
}
arResult: {
PARAMS_HASH : "9bacde48eda26d431ef26c0ad582f49d"
capCode: "0d68181348986b338adf6b02cf954da2"
}
Array
(
[PARAMS_HASH] => 9bacde48eda26d431ef26c0ad582f49d
[ERROR_MESSAGE] => Array
(
[0] => Вы не написали сообщение.
)
[MESSAGE] =>
[AUTHOR_NAME] => admin
[AUTHOR_EMAIL] => [email protected]
)
Answer the question
In order to leave comments, you need to log in
Most likely, the component (not the template) does not receive all the necessary parameters that come with a regular post. I'm confused why your captcha pops up. The component is standard - form.result.new?
Try to see the difference in requests between normal and ajax by adding the code:
echo json_encode(array(
'arResult' => $arResult,
'GET' => $_GET,
'POST' => $_POST,
));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question