PHPackages                             pigochu/yii2-ajax-renderer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. pigochu/yii2-ajax-renderer

ActiveYii2-extension

pigochu/yii2-ajax-renderer
==========================

Yii2 Ajax Render Widget

1234JavaScript

Since Feb 29Pushed 10y ago1 watchersCompare

[ Source](https://github.com/pigochu/yii2-ajax-renderer)[ Packagist](https://packagist.org/packages/pigochu/yii2-ajax-renderer)[ RSS](/packages/pigochu-yii2-ajax-renderer/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

Yii2 Ajax Renderer
==================

[](#yii2-ajax-renderer)

This widget was originally developed idea is that, sometimes we need dynamic add new ROW to table , but it's hard to develop in frontend, more simple way is produced by the backend, and keep only need to dynamically add content to the frontend.

Install :
---------

[](#install-)

```
composer require pigochu/yii2-ajax-renderer:"dev-master"

```

Usage :
-------

[](#usage-)

### View

[](#view)

```

       never display in AJAX mode

      display in normal mode and AJAX mode

```

If we use normal call , result is :

```

      0 never display in AJAX mode
      1 never display in AJAX mode
      2 never display in AJAX mode

      display in normal mode and AJAX mode

```

If use AJAX call , result is :

```

      display in normal mode and AJAX mode

```

### call $.renderAjax()

[](#call-renderajax)

client has provided $.renderAjax() can handle ajax content, it will filter script or css put into the head tag, let's DOM will not mess.

This sample will load url , and append content to $('#tbl tbody')

```

$('#yourButtonId').on('click' , function(){
	$.renderAjax({
	    url : "",
	    renderMode : 'append',
	    targetElement : $('#tbl tbody')
	});
});

```

$.renderAjax Usage :
--------------------

[](#renderajax-usage-)

Basic Syntax: $.renderAjax(options)。

$.renderAjax() need three options :

```
$.renderAjax({
    url : "",
    renderMode : 'append',
    targetElement : $('#tbl tbody')
});

```

- url : The url you want to load.
- renderMode : Render Mode can be 'replace', 'append', and 'prepend' , default is 'replace'
- targetElement : The element you want to replace/append/prepend content.

You can also put $.ajax defined options :

```
$.renderAjax({
    url : "",
    renderMode : 'append',
    targetElement : $('#tbl tbody'),
    method: 'POST',
    error: function( jqXHR, textStatus, errorThrown ) { // .... }
});

```

$.renderAjax() defined two additional events : beforeRender and afterRender

```
$.renderAjax({
    url : "",
    renderMode : 'append',
    targetElement : $('#tbl tbody'),
    beforeRender : function(data , options , originData) { // if ajax call success，than trigger this event },
    afterRender : function(data , options , originData) { // if ajax call success, and render success , than trigger this event  },
});

```

beforeRender &amp; afterRender callback options

- data : This is an array , renderAjax parse response data than convert to \[contents,scripts,links\] , you can modify it at beforeRender or init some plugin at afterRender.
- options : This is $.renderAjax(options) passed to the callback
- originData : Origin response data

###  Health Score

24

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/18e30c876940144ab03a883aabb9182de20342d41f27ee9f585a612594a0548c?d=identicon)[pigochu](/maintainers/pigochu)

---

Top Contributors

[![pigochu](https://avatars.githubusercontent.com/u/1013744?v=4)](https://github.com/pigochu "pigochu (7 commits)")

### Embed Badge

![Health badge](/badges/pigochu-yii2-ajax-renderer/health.svg)

```
[![Health](https://phpackages.com/badges/pigochu-yii2-ajax-renderer/health.svg)](https://phpackages.com/packages/pigochu-yii2-ajax-renderer)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
