ajax form submit

I have ajax form submit.

If I submit, script send ajax request, but user stay on this page and maybe he want to edit this form again.

Second submit not send ajax request, I don’t know why.

I have this code

<?php $form = ActiveForm::begin([

                'id' =&gt; 'form-user-setting',


                'options' =&gt; [


                    'class' =&gt; 'form-horizontal',


                ],


                'enableAjaxValidation' =&gt; true,


                'enableClientValidation' =&gt; true,


                'validateOnChange' =&gt; false,


                'validationDelay' =&gt; false,


                'validateOnBlur' =&gt; false,


                'validateOnType' =&gt; false,


                'validateOnSubmit'=&gt;true,


                'validationUrl' =&gt; ['/user/update-ajax-user'],


                'requiredCssClass' =&gt; '',


            ]); ?&gt;


                &lt;h4 class=&quot;mb-xlg&quot;&gt;Пользовательские настройки&lt;/h4&gt;


                &lt;fieldset&gt;


                    &lt;div class=&quot;form-group&quot;&gt;


                        &lt;div class=&quot;col-md-8 col-md-offset-3&quot;&gt;


                            &lt;div id=&quot;form-user-setting-flash-success&quot; class=&quot;form-control alert-success&quot; style=&quot;display: none&quot;&gt;Настройки профиля успешно изменеы&lt;/div&gt;


                        &lt;/div&gt;


                    &lt;/div&gt;


                    &lt;div class=&quot;form-group&quot;&gt;


                        &lt;div class=&quot;col-md-8 col-md-offset-3&quot;&gt;


                            &lt;div id=&quot;form-user-setting-flash-error&quot; class=&quot;form-control alert-danger&quot; style=&quot;display: none&quot;&gt;Форма заполнена неправильно&lt;/div&gt;


                        &lt;/div&gt;


                    &lt;/div&gt;





                    &lt;?= &#036;form-&gt;field(&#036;user-&gt;userSetting, 'nickname', ['template' =&gt; '{label}&lt;div class=&quot;col-md-8&quot;&gt;{input}&lt;/div&gt;', 'labelOptions' =&gt; ['class' =&gt; 'col-md-3 control-label']])-&gt;textInput() ?&gt;


                    &lt;?= &#036;form-&gt;field(&#036;user-&gt;userSetting, 'show_nickname', ['checkboxTemplate' =&gt; '{label}&lt;div class=&quot;col-md-8&quot;&gt;&lt;div class=&quot;checkbox-custom checkbox-default checkbox-inline mt-xs&quot;&gt;{input}&lt;label&gt;&lt;/label&gt;&lt;/div&gt;&lt;/div&gt;', 'labelOptions' =&gt; ['class' =&gt; 'col-xs-3 control-label mt-xs pt-none'] , 'options' =&gt; ['class' =&gt; 'form-group']])-&gt;label()-&gt;checkBox(['value' =&gt; 1]) ?&gt;


                    &lt;?= &#036;form-&gt;field(&#036;user-&gt;userSetting, 'show_panel', ['checkboxTemplate' =&gt; '{label}&lt;div class=&quot;col-md-8&quot;&gt;&lt;div class=&quot;checkbox-custom checkbox-default checkbox-inline mt-xs&quot;&gt;{input}&lt;label&gt;&lt;/label&gt;&lt;/div&gt;&lt;/div&gt;', 'labelOptions' =&gt; ['class' =&gt; 'col-xs-3 control-label mt-xs pt-none'] , 'options' =&gt; ['class' =&gt; 'form-group']])-&gt;label()-&gt;checkBox(['value' =&gt; 1]) ?&gt;


                    &lt;?= &#036;form-&gt;field(&#036;user-&gt;userSetting, 'about', ['template' =&gt; '{label}&lt;div class=&quot;col-md-8&quot;&gt;{input}{error}&lt;/div&gt;', 'labelOptions' =&gt; ['class' =&gt; 'col-md-3 control-label']])-&gt;textarea() ?&gt;


                    &lt;?= &#036;form-&gt;field(&#036;user-&gt;userSetting, 'specialty', ['template' =&gt; '{label}&lt;div class=&quot;col-md-8&quot;&gt;{input}&lt;/div&gt;', 'labelOptions' =&gt; ['class' =&gt; 'col-md-3 control-label']])-&gt;textInput() ?&gt;


                    &lt;div class=&quot;row&quot;&gt;


                        &lt;div class=&quot;col-md-9 col-md-offset-3&quot;&gt;


                            &lt;?= Html::submitButton('Изменить', ['class' =&gt; 'btn btn-primary', 'name' =&gt; 'signup-button']) ?&gt;


                        &lt;/div&gt;


                    &lt;/div&gt;


                &lt;/fieldset&gt;


                &#60;script&gt;


                    &#036;(document).ready(function() {


                        &#036;('#form-user-setting').on('submit', function(e){


                            console.log(1);





                            e.preventDefault();


                        }).on('afterValidate', function (e, messages, deferred, attribute) {





                            e.preventDefault();





                            var isSuccess = true;


                            &#036;.each(messages, function(k, v){


                                if(&#33;&#036;.isEmptyObject(v)){


                                    isSuccess = false;


                                }


                            });





                            if(isSuccess){


                                &#036;(&quot;#form-user-setting-flash-success&quot;).show().fadeIn(100).fadeOut(5000);


                            }else{


                                &#036;(&quot;#form-user-setting-flash-error&quot;).show().fadeIn(100).fadeOut(5000);


                            }





                        });


                    });


                &lt;/script&gt;


            &lt;?php ActiveForm::end(); ?&gt;