Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lichunqiang/yii2-ajaxform
submit ActiveForm via ajax
https://github.com/lichunqiang/yii2-ajaxform
ajax yii-extension yii2 yii2-ajaxform
Last synced: 10 days ago
JSON representation
submit ActiveForm via ajax
- Host: GitHub
- URL: https://github.com/lichunqiang/yii2-ajaxform
- Owner: lichunqiang
- License: mit
- Created: 2015-11-24T13:22:40.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-05-08T07:59:48.000Z (over 5 years ago)
- Last Synced: 2024-09-18T16:17:58.474Z (about 2 months ago)
- Topics: ajax, yii-extension, yii2, yii2-ajaxform
- Language: PHP
- Homepage:
- Size: 36.1 KB
- Stars: 20
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-yii2 - yii2-ajaxform
README
Yii2 Ajax Form
[![Build Status](https://img.shields.io/travis/lichunqiang/yii2-ajaxform.svg?style=flat-square)](http://travis-ci.org/lichunqiang/yii2-ajaxform)
[![version](https://img.shields.io/packagist/v/light/yii2-ajaxform.svg?style=flat-square)](https://packagist.org/packages/light/yii2-ajaxform)
[![Download](https://img.shields.io/packagist/dt/light/yii2-ajaxform.svg?style=flat-square)](https://packagist.org/packages/light/yii2-ajaxform)
[![Issues](https://img.shields.io/github/issues/lichunqiang/yii2-ajaxform.svg?style=flat-square)](https://github.com/lichunqiang/yii2-ajaxform/issues)## Overview
Using `jquery.form` to make `ActiveForm` has ability to submit via ajax but not fullpage reload.
## Install
Using composer:
```
$ composer require light/yii2-ajaxform=*
```## Usage
```php
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.")}')
]
])```
### Options
* Default enabled `enableAjaxSubmit` is true
* `ajaxSubmitOptions` you can find in [jquery.form](https://github.com/malsup/form)## Test
```
$ phpunit
```
## LICENSE![MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/lichunqiang/yii2-ajaxform/trend.png)](https://bitdeli.com/free "Bitdeli Badge")