light / yii2-ajaxform
yii2 activeform ActiveForm ajax
1.0.3
2019-05-08 07:56 UTC
Requires
- php: >=5.4.0
- bower-asset/jquery-form: ~3.51
- yiisoft/yii2: ~2.0.6
Requires (Dev)
- phpunit/phpunit: ^4.8
This package is auto-updated.
Last update: 2024-09-08 19:30:48 UTC
README
Yii2 Ajax Form
概述
使用 jquery.form
使 ActiveForm
具备通过ajax提交的能力,但不会进行全页刷新。
安装
使用 composer
$ composer require light/yii2-ajaxform=*
用法
use light\widgets\ActiveForm; use yii\web\JsExpression; ActiveForm::begin([ 'ajaxSubmitOptions' => [ 'success' => new JsExpression('function(response) {console.log(response)}'), 'complete' => new JsExpression('function() {console.log("request completed.")}') ] ])
选项
- 默认启用的
enableAjaxSubmit
为 true ajaxSubmitOptions
可以在 jquery.form 中找到
测试
$ phpunit