Yii2 Pjax on ActiveForm and GridView [ Got it Working]
<p><a href="https://i.stack.imgur.com/bKQf8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bKQf8.png" alt="index page"></a><br>
<a href="https://i.stack.imgur.com/4Coif.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4Coif.png" alt="Modal when clicked on remove member"></a><br>
<a href="https://i.stack.imgur.com/MV9pg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MV9pg.png" alt="when form submitted"></a><br>
I have a gridview </p>

<pre><code>&lt;?php Pjax::begin(['id' =&gt; 'members']) ?&gt; 

&lt;?= GridView::widget([
        'dataProvider' =&gt; $dataProvider,
        // 'filterModel' =&gt; $searchModel,
        'columns' =&gt; [
        ['header'=&gt;'Remove Member',
                        'value'=&gt; function($data)
                        { 
                            return  Html::a(Yii::t('app', ' {modelClass}', [
                                'modelClass' =&gt;'',
                            ]), ['members/stl_remove','id'=&gt;$data-&gt;id], 
                            ['class' =&gt; 'btn btn-link fa fa-times fa-2x pop']
                            );  
                        },
            'format' =&gt; 'raw'
            ],
      ['class' =&gt; 'yii\grid\ActionColumn','template'=&gt;'{update}'],
        ],
    ]); ?&gt;
    &lt;?php Pjax::end() ?&gt;
</code></pre>

<p>when i click on the Remove members link a modal popsup (delete.php)</p>

<pre><code>&lt;?php Pjax::begin(['id' =&gt; 'delete_members']) ?&gt;

    &lt;?php $form = ActiveForm::begin(['options' =&gt; ['data-pjax' =&gt; true ]]); ?&gt; 

    &lt;div class="row"&gt;
        &lt;div class="col-md-5"&gt;

            &lt;?php echo $form-&gt;field($model, 'remarks')-&gt;dropDownList(['death' =&gt; 'Death',
                'marriage' =&gt; 'Marriage', 'house_shift' =&gt; 'House Shift'],['prompt'=&gt;'Select'])
                -&gt;label("Reason For Removal"); ?&gt;

        &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="form-group"&gt;
        &lt;?= Html::submitButton($model-&gt;isNewRecord ? Yii::t('app', 'Remove') : Yii::t('app', 'Update'), ['class' =&gt; $model-&gt;isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?&gt;
    &lt;/div&gt;

    &lt;?php ActiveForm::end(); ?&gt;
    &lt;?php yii\widgets\Pjax::end() ?&gt;
</code></pre>

<p>Now these are my controller code
[code]</p>

<pre><code>public function actionStl_remove($id,$ajax=0)
    {
        $model              =   $this-&gt;findModel($id);
        $model_delete       =   new Members();
        $model-&gt;scenario    =   "remove";

        if ($model_delete-&gt;load(Yii::$app-&gt;request-&gt;post())) 
        {
            $model-&gt;remarks =   $model_delete-&gt;remarks;
            $model-&gt;status  =   1;
            $model-&gt;save();
            // $model = new Members();
            // return $this-&gt;redirect(['index']);
        }
        else
        {
        return $this-&gt;renderAjax('delete', [
                'model' =&gt;  $model_delete,
                'id'    =&gt;  $id,
            ]);
        }
    }
</code></pre>

<p>I am not able to get data loaded into gridview. I click on the link modal popsup then i submit after that i go on to the index page and the <strong>page reloads</strong></p>