loveorigami/yii2-ajaxq Customizable ajaxq widget for Yii2

widgetajaxajaxq

Ajaxq Widget for Yii2

A customizable AjaxQ jQuery plugin for Yii2 based on Ajaxq.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require "loveorigami/yii2-ajaxq" "*"

or add

"loveorigami/yii2-ajaxq" : "*"

to the require section of your application's composer.json file.

Usage

  • In view:
use lo\widgets\Ajaxq;

<?php
 echo Ajaxq::widget([
      'url' => '/site/demo',
      // 'success' =>'$(".res").html(res)',
      // 'tpl' => 'from_to' // default view for generating ajax requests
  ]);
  • In controller:
    /**
     * Controller name - Site
     * Demo for ajaxq request
     * @return json
     */
    public function actionDemo()
    {
        $post = \Yii::$app->request->post('dataq'); // get associative array dataq

        \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;

        $data['id'] = $post['id'];
        $data['mes'] = $post['id'].' - It is ok!';

        $res = print_r($data, true);

        echo json_encode($res);
    }

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

  • 1.002 July 2015

Comments



1.0 is the latest of one release



MIT license
Stats
0 github stars & 0 github forks
0 downloads in the last day
0 downloads in the last 30 days
21 total downloads