Created
September 5, 2019 19:19
-
-
Save ASDAFF/5e1700e6ea726ce2671a6e007ca86770 to your computer and use it in GitHub Desktop.
Регистрация пользователя Ajax Битрикс
This file contains 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
<? | |
include($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php"); | |
global $USER; | |
$arResult = $USER->Register($_REQUEST['mail'], $_REQUEST['name'], $_REQUEST['last_name'], $_REQUEST['pass'], $_REQUEST['pass'], $_REQUEST['mail']); | |
exit(json_encode($arResult)); |
This file contains 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
//регистрация нового пользователя | |
$(document).on("click", '#register', function(e) { | |
e.preventDefault(); | |
$.ajax({ | |
url: '/local/ajax/register.php', | |
data: { | |
name: $('#register_form input[name="name"]').val(), | |
last_name: $('#register_form input[name="last_name"]').val(), | |
phone: $('#register_form input[name="phone"]').val(), | |
pass: $('#register_form input[name="passw"]').val(), | |
mail: $('#register_form input[name="mail"]').val(), | |
}, | |
dataType: 'json', | |
success: function(result){ | |
if(result.TYPE == 'ERROR'){ | |
$('#register_result').html(result.MESSAGE).css({"color": "red"}); | |
}else{ | |
$('#register_result').html(result.MESSAGE).css({"color": "green"}); | |
setTimeout(function(){ | |
location.reload(); | |
}, 1000); | |
} | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment