yiisoft/yii2 — pull request #1970 by olegchir (2014-01-14 14:47:37+00:00)
Title: Fixes: 1350. Add ability to submit forms with ajax

Add ability to submit forms with ajax, process post-submit hooks and send additional data, excatly as in #1350.

I use http://jquery.malsup.com/form/ (BSD license, pretty mature) as a default implementation of .ajaxSubmit.

It is my first PR for this project, please review this.

```php
$form = ActiveForm::begin(['id' => 'contact-form',
'withAjaxSubmit' => true,

'afterSubmit' => new JsExpression('function($form, data, status, xhr) {
console.log("afterSubmit");
console.log(data);
console.log(status);
console.log(xhr);
}'),

'afterSuccessfulSubmit' => new JsExpression('function($form, data, status, xhr) {
console.log("afterSuccessfulSubmit");
console.log(data);
console.log(status);
console.log(xhr);
}'),

'afterUnsuccessfulSubmit' => new JsExpression('function($form, data, status, xhr) {
console.log("afterUnsuccessfulSubmit");
console.log(data);
console.log(status);
console.log(xhr);
}'),

'immediatelyAfterSubmit' => new JsExpression('function($form) {
console.log("immediatelyAfterSubmit");
}'),

'ajaxData' => [ 'ordering' => new JsExpression('2*2') ],
]);
```