示例#1
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use frontend\models\PhoneForm;
use yii\widgets\Pjax;
$model = new PhoneForm();
$ajax = 0;
if (Yii::$app->request->isPjax) {
    $model->call();
}
?>


<?php 
Pjax::begin(['id' => 'my-pjax']);
?>
	<?php 
if ($ajax) {
    ?>
		<p> <?php 
    echo $ajax;
    ?>
.</p>
	<?php 
} else {
    ?>
		<?php 
    $form = ActiveForm::begin(['options' => ['data-pjax' => true]]);
    ?>
			<?php 
示例#2
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use frontend\models\PhoneForm;
use yii\widgets\Pjax;
$model = new PhoneForm();
$ajax = 0;
if (Yii::$app->request->isPjax) {
    $model->call();
}
?>


<?php 
Pjax::begin(['id' => 'my-pjax']);
?>
	<?php 
if ($ajax) {
    ?>
		<p> <?php 
    echo $ajax;
    ?>
.</p>
	<?php 
} else {
    ?>
		<?php 
    $form = ActiveForm::begin(['options' => ['class' => $class, 'data-pjax' => true, 'onsubmit' => "yaCounterXXXXXX.reachGoal('formReplyQuestion'); return true;"]]);
    ?>
			<? 	if (isset($text)) {