Answer the question
In order to leave comments, you need to log in
How to run Yii::app()->runController in isAjaxRequest block in Yii?
Good afternoon,
For some reason, this method works in the main body of the action, but nothing is generated with isAjaxRequest (
public function actionCreate()
{
if (Yii::app()->request->isAjaxRequest
{
// Тут не работает = (((
Yii::app()->runController('sadmin/hotels/update/id/1416');
Yii::app()->end();
}
else
{
$model = new Hotels();
// тут работает
Yii::app()->runController('sadmin/hotels/update/id/1416');
$this->render('create', ['model'=>$model,]);
}
}
echo CHtml::ajaxSubmitButton
(
$model->isNewRecord ? 'Добавить номера' : 'Обновить',
Yii::app()->createUrl('sadmin/hotels/create'),
[
'success'=>'js:function(data)
{
displayMessage(data);
$("#hotels-form").remove();
$("#crud-hotel").append(data);
}',
'error'=>'js:function()
{
alert("Плохо");
}',
],
[
'id'=>'add-hotel',
'class'=>'btn btn-primary btn-lg center-block',
]
);
die($value)
, they returnYii::app()->runController('sadmin/hotels/update/id/1416')
in isAjaxRequest it is definitely processed, because if I deliberately make a mistake inside the line 'sadmin/hotels/update/id/1416' then I get into the error block at ajaxSubmitButtonAnswer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question