Answer the question
In order to leave comments, you need to log in
How to ignore yii markup on ajax request?
I make an ajax request that refers to the controller's action.
As a result, an html page should be accepted in response, which is redrawn before the creation of the content!
All implemented:
ajax request:
$.ajax({
url: "http://portfolio/blog/index",
data: 'id='+result.id,
dataType: 'html',
success: function (data) {
$('.conteiner').html(data);
},
error: function () {
alert("error");
}
});
public function actionIndex()
{
return $this->render('block-blog', [
'posts' => Post::find(),
'category' => Category::find(),
'currentCategory' => Yii::$app->request->get('id'),
]);
}
Answer 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