shivani parmar shivani parmar - 6 months ago 63
PHP Question

stop pjax to replace a link with return data

i have put below code

<?php
/* helpers */
use yii\helpers\Html;
use yii\helpers\URL;

use yii\grid\GridView;
/* widgets */
use yii\widgets\Pjax;
use yii\bootstrap\Modal;

Pjax::begin(['id'=>'view_member']);
echo Html::a('view',URL::to(['view','id'=>$model->_id]),['class'=>'show']);
Pjax::end();


this code show a anchor link and after click of this link it replace a link with data return by ajax.

I don't want to replace a link with data. I need link as it is with return data.

Before I click on a view anchor link

enter image description here

After click of view link

enter image description here

Answer

I'd either return the link with the modal HTML or target the link from the Pjax widget, linkSelector.

echo Html::a('view',URL::to(['view','id'=>$model->_id]),['id' => 'view_link', 'class'=>'show']);
Pjax::widget(['id'=>'view_member', 'linkSelector' => '#view_link']);
Comments