Created
October 4, 2017 08:07
-
-
Save steepzero-old/5ce778abc91b2cd03121c50b110792b8 to your computer and use it in GitHub Desktop.
D7 и Ajax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
require_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_before.php'); | |
use \Bitrix\Main\Application; | |
use \Bitrix\Main\Web\Json; | |
$request = Application::getInstance()->getContext()->getRequest(); | |
if($request->isAjaxRequest() && check_bitrix_sessid()){ | |
$res = true; | |
$res &= (bool) $request->getPost('NAME'); | |
$res &= (bool) $request->getPost('PHONE'); | |
$res &= (bool) $request->getPost('EMAIL'); | |
$res &= (bool) $request->getPost('MESSAGE'); | |
$res &= (bool) $request->getPost('AGREEMENT'); | |
if($res){ | |
$arFields = array( | |
'NAME' => $request->getPost('NAME'), | |
'PHONE' => $request->getPost('PHONE'), | |
'EMAIL' => $request->getPost('EMAIL'), | |
'MESSAGE' => $request->getPost('MESSAGE'), | |
'AGREEMENT' => $request->getPost('AGREEMENT'), | |
); | |
$res &= (bool) \CEvent::Send('FEEDBACK_FORM','s1',$arFields); | |
} | |
echo Json::encode(array( | |
'status' => $res | |
)); | |
exit; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment