{"action":"created","issue":{"url":"https://api.github.com/repos/demogorgorn/yii2-ajax-submit-button/issues/6","labels_url":"https://api.github.com/repos/demogorgorn/yii2-ajax-submit-button/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/demogorgorn/yii2-ajax-submit-button/issues/6/comments","events_url":"https://api.github.com/repos/demogorgorn/yii2-ajax-submit-button/issues/6/events","html_url":"https://github.com/demogorgorn/yii2-ajax-submit-button/issues/6","id":75765730,"number":6,"title":"Usage not possible with ActiveForm?","user":{"login":"waza-ari","id":4508976,"avatar_url":"https://avatars.githubusercontent.com/u/4508976?v=3","gravatar_id":"","url":"https://api.github.com/users/waza-ari","html_url":"https://github.com/waza-ari","followers_url":"https://api.github.com/users/waza-ari/followers","following_url":"https://api.github.com/users/waza-ari/following{/other_user}","gists_url":"https://api.github.com/users/waza-ari/gists{/gist_id}","starred_url":"https://api.github.com/users/waza-ari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waza-ari/subscriptions","organizations_url":"https://api.github.com/users/waza-ari/orgs","repos_url":"https://api.github.com/users/waza-ari/repos","events_url":"https://api.github.com/users/waza-ari/events{/privacy}","received_events_url":"https://api.github.com/users/waza-ari/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-12T22:41:21Z","updated_at":"2015-05-13T15:17:51Z","closed_at":null,"body":"I am using an active form based on a model and want to submit this via Ajax. The view code basically looks like this:\r\n\r\n```php\r\n        <?php $clubForm = ActiveForm::begin([\r\n            'action' => Url::to(['club/ajax-create']),\r\n        ]); ?>\r\n\r\n        <?= $clubForm->field($clubModel, 'name')->textInput(['maxlength' => 150]) ?>\r\n\r\n        <?= $clubForm->field($clubModel, 'nation')->dropDownList(\r\n            ArrayHelper::map(Nation::find()->all(), 'id', 'name')\r\n        ) ?>\r\n\r\n        <div class=\"form-group\">\r\n            <?php AjaxSubmitButton::begin([\r\n                'label' => 'Speichern',\r\n                'id' => 'saveClubButton',\r\n                'ajaxOptions' => [\r\n                    'type' => 'POST',\r\n                    'url' => Url::to(['club/ajax-create']),\r\n                    'success' => new \\yii\\web\\JsExpression('saveCreatedClub(result)'),\r\n                ],\r\n                'options' => ['class' => 'btn btn-success', 'type' => 'submit'],\r\n            ]);\r\n            AjaxSubmitButton::end();\r\n            ?>\r\n        </div>\r\n\r\n        <?php ActiveForm::end(); ?>\r\n```\r\n\r\nHowever, pressing the button causes the form to perform a POST request, and the page is reloaded, instead if an AJAX request. (Action is the page where the widget is used)."},"comment":{"url":"https://api.github.com/repos/demogorgorn/yii2-ajax-submit-button/issues/comments/101712504","html_url":"https://github.com/demogorgorn/yii2-ajax-submit-button/issues/6#issuecomment-101712504","issue_url":"https://api.github.com/repos/demogorgorn/yii2-ajax-submit-button/issues/6","id":101712504,"user":{"login":"waza-ari","id":4508976,"avatar_url":"https://avatars.githubusercontent.com/u/4508976?v=3","gravatar_id":"","url":"https://api.github.com/users/waza-ari","html_url":"https://github.com/waza-ari","followers_url":"https://api.github.com/users/waza-ari/followers","following_url":"https://api.github.com/users/waza-ari/following{/other_user}","gists_url":"https://api.github.com/users/waza-ari/gists{/gist_id}","starred_url":"https://api.github.com/users/waza-ari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waza-ari/subscriptions","organizations_url":"https://api.github.com/users/waza-ari/orgs","repos_url":"https://api.github.com/users/waza-ari/repos","events_url":"https://api.github.com/users/waza-ari/events{/privacy}","received_events_url":"https://api.github.com/users/waza-ari/received_events","type":"User","site_admin":false},"created_at":"2015-05-13T15:17:51Z","updated_at":"2015-05-13T15:17:51Z","body":"Hi! Thank you for your answer. Sorry, the action was only added for testing purposes, the described behaviour also happens if the section is not there.\r\n\r\nAt the current stage in development, the server is running local on my laptop, and the request is a simple creation of one new database entry - this should not be the issue. For the moment, I just created a button and a few lines of JS myself, and this works - however I will try this extension again and provide further details. I cannot give an exact point in time, though."}}