light/yii2-ajaxform

yii2 activeform ActiveForm ajax

1.0.3 2019-05-08 07:56 UTC

This package is auto-updated.

Last update: 2024-09-08 19:30:48 UTC


README

Yii2 Ajax Form


Build Status version Download Issues

概述

使用 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

许可证

MIT

Bitdeli Badge