Modal::begin([
'header' => '<div class="common__board-title-big" style="text-align: center; font-size: 18px;">To a specified number of SMS sent with a verification code. Enter the code in the box below. </div>',
'toggleButton' => [
'label' => 'Register',
'tag' => 'button',
'class' => 'guest__btn_submit modal-register register',
],
]);
?>
<div class="m-b-15 row">
<div class="col-md-12 common__board-col" style="padding-left:30%; padding-right: 30%">
<div class="form-group highlight-addon has-success">
<?= Html::hiddenInput('hash-code', $hash_code, ['class' => 'hash-code']) ?>
<?= Html::input('text', 'code', ", ['class' => 'modal-input', 'style' => "font-size: 25px; padding: 5% 20%; text-align: center;"]) ?>
</div>
<div class="form-group">
<?= Html::submitButton('Send', ['class' => 'btn-n-brd-lblue__fill send-button register']) ?>
</div>
<div class="form-group">
<?= Html::button('Get new code', ['class' => 'btn-n-brd-lblue__fill get_new_code', 'style' => 'display: none']) ?>
<div id="timerBlock" class="common__board-title-big" style="text-align: center; font-size: 15px">
<p>to Perezapustit code using <span class="seconds"> 10 </span> seconds</p>
</div>
</div>
</div>
</div>
<?php Modal::end(); ?>
$('.get_new_code').on('click', function(event) {
//event.preventDefault();
var number = $('#profile-phone').val();
var hash = $('.hash-code').val();
$.ajax({
url: '/registration/generate-new-hash',
type: 'POST',
data: {number : number, hash : hash},
success: function(res){
console.log(res);
},
error: function(xhr, status, error){
console.log(error);
}
});
})
event.preventDefault();
Find more questions by tags Yii