Yii2 And Ajax

Hi, I’m new o Yii2, sorry to ask somthing that simple, but I can’t find any information about a button that load using ajax a url inside a element…

The usage, is to load a form inside a modal, but I want to load multiple pages. How can I do it in Yii2?

The same way you do it without Yii.

For example, in case of bootstrap modals:

$('#add-item').on('click', function(e) {


        remote: "<?= Html::url(['edit', 'id' => $record->id]) ?>"


    return false;


Also you can use some widgets shipped with Yii, but the main idea remains the same: $(‘selector’).on(‘event’, eventHandler())

Thanks !!!!

Is there any Yii2 widget that can handle this?

Take a look at Pjax

I put all of my views in a pjax block and added it to my forms also.