Answer the question
In order to leave comments, you need to log in
Yii2 how to fire action for modal window?
Hello everyone, I'm new to Yii2, a lot of things are not clear) so I can ask stupid questions .... Guys, tell me how to organize the launch of the action.
Let's say I have a main page with the main url www.test.ru/system - system the main page of the class, i.e. rendering takes place on actionIndex.
on system.php I have a panel with buttons, for example, let's take three buttons
<button id='zhurnal">Журнал<button>
<button id='status">Статус<button>
<button id='createZakupki">Закупка<button>
Answer the question
In order to leave comments, you need to log in
<button id="zhurnal" data-url="/system/journal">Журнал<button>
<button id="status" data-url="/system/status">Статус<button>
<button id="createZakupki" data-url="/system/order">Закупка<button>
$('button[data-url]').click(function(e) {
$.ajax({
url: $(this).data('url'),
type: 'get',
dataType: 'html'
}).done(function(response) {
$('.modal-body').html(response);
});
})
// ...
public function actionJournal()
{
return $this -> renderAjax('journal');
}
// ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question