Yii2 – Bootstrap Modal

The work of implementing the modal window will be made easy by Bootstrap, which is a default framework bundled with the basic app.

The modal window is composed by an almost pre-determined markup and an additional JS, which provides the interaction part, thereby hooking it to the rest of the interface. I hope that the simplicity of its implementation will let you focus on the aim that lies behind it.


Add the class to your index.php file.

Now just create your buttons to load into the modal!

change as

Things you must have on the button is id modelButton because that is what we told our JS function in the beginning of this model to look out for.

Add the bootstrap modal to your layouts

set up the each and every actions to you want to use ajax on to handle the ajax by using renderAjax() instead of render(). The only difference is that renderAjax will only load the page content and render will load the page content and the layout.

Change as

Add script to id modelButton



Prakash S

Prakash S

I would like to introduce myself as a Software professional opting for the career in software industry. I'm Prakash S, a MCA graduate and trained as industry level practice for Software technology. Basically I am a PHP Developer but now days exploring more in HTML5, CSS, AngularJS and jQuery libraries.