src/widgets/ModalButton.php
public function registerAjaxSubmit()
    {
        $view = Yii::$app->view;

        $options = ArrayHelper::merge([
            'type' => new JsExpression("form.attr('method')"),
            'url' => new JsExpression("form.attr('action')"),
            'data' => new JsExpression('form.serialize()'),
        ], $this->ajaxOptions);
        $options = Json::encode($options);

        $view->registerJs(<<<JS
            $('form[data-ajax-submit]').on('submit', function(event) {
                var form = $(this);
                if (event.eventPhase === 2) {
                    $.ajax($options);
                    $('.modal-backdrop').remove();
                }
                event.preventDefault();
            });
JS
        );
    }
public function registerAjaxSubmit()
    {
        $view = Yii::$app->view;

        $options = ArrayHelper::merge([
            'type' => new JsExpression("form.attr('method')"),
            'url' => new JsExpression("form.attr('action')"),
            'data' => new JsExpression('form.serialize()'),
        ], $this->ajaxOptions);
        $options = Json::encode($options);

        $view->registerJs(<<<JS
            $('form[data-ajax-submit]').on('submit', function(event) {
                var form = $(this);
                if (event.eventPhase === 2) {
                    $.ajax($options);
                    $('.modal-backdrop').remove();
                }
                event.preventDefault();
            });
JS
        );
    }
public function registerAjaxSubmit ( ) { $ view = Yii :: $ app -> view ; $ options = ArrayHelper :: merge ( [ 'type' => new JsExpression ( "form.attr('method')" ) , 'url' => new JsExpression ( "form.attr('action')" ) , 'data' => new JsExpression ( 'form.serialize()' ) , ] , $ this -> ajaxOptions ) ; $ options = Json :: encode ( $ options ) ; $ view -> registerJs ( <<<JS
            $('form[data-ajax-submit]').on('submit', function(event) {
                var form = $(this);
                if (event.eventPhase === 2) {
                    $.ajax($options);
                    $('.modal-backdrop').remove();
                }
                event.preventDefault();
            });
JS ) ; }
Registers JavaScript for ajax submit.
Registers JavaScript for ajax submit .