Last active
July 25, 2025 05:59
-
-
Save MrWhiteD/c662009e95bd246c11a53a23ec8abcd2 to your computer and use it in GitHub Desktop.
[Обновление капчи] #captcha #капча
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
| /* Обновление капчи */ | |
| $('#captcha_img').on('click', function () { | |
| BX.ajax.getCaptcha(function(result) { | |
| $('#captcha_sid').val(result["captcha_sid"]); | |
| $('#captcha_word').val(''); | |
| $('#captcha_img').attr('src', '/bitrix/tools/captcha.php?captcha_code='+result["captcha_sid"]); | |
| }); | |
| }); | |
| ----------------------------------------------------------------------- | |
| с использованием BX.proxy | |
| BX.ready(function(){ | |
| $('.captcha__reset').on('click', function () { | |
| BX.ajax.getCaptcha(BX.proxy(function(result) { | |
| $(this).closest('.captcha').find('[name="captcha_sid"]').val(result["captcha_sid"]); | |
| $(this).closest('.captcha').find('[name="captcha_word"]').val(''); | |
| $(this).closest('.captcha').find('.captcha__image').attr('src', '/bitrix/tools/captcha.php?captcha_code='+result["captcha_sid"]); | |
| }, this)); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment