$.post(
"/calc/universal/get-format", {
id: $('#div').val()
},
function (format) {
тут разный код
потом опять аякс запрос и дальше код внутри его функции
и так не сколько раз, и переменные больше не теряются )
}
);
<head>
<meta charset="<?= Yii::$app->charset ?>"/>
<meta name="viewport" content="width=device-width; initial-scale=0.85; maximum-scale=0.85; user-scalable=0;"/>
<meta name="yandex-verification" content="......"/>
<?= Html::csrfMetaTags() ?>
<title><?= Html::encode($this->title) ?></title>
<?php $this->head() ?>
</head>
pq('div#video-player-bg > div#html5video > a')->attr('href');
if ($this->cancel_flag == 0) {
$query->andFilterWhere(['not', ['address.user_id' => null]])
->andWhere(['not', ['address.project_id' => null]])
->andWhere(['not', ['address.project_template_id' => null]])
->andWhere(['address.monitor' => 1]);
}
'bootstrap' => [
'app\components\MainComponent',
],
class MainComponent extends Component
{
public $roles = ['root', 'admin']; // разрешенные роли
public function init()
{
if (Yii::$app->params['is_offline'] == 1) {
$enable_role = in_array(Yii::$app->user->identity->role, $this->roles);
$ips = explode(',', Yii::$app->params['allow_ip']);
$ips = array_map("trim", $ips);
$enable_ip = in_array($this->getIp(), $ips); //check "allowed IP"
if(!$enable_role AND !$enable_ip) {
die(Yii::$app->params['closeText']);
}
}
}
$array = array_column($playoff, 'user_id');
foreach ($array as $key => $item) {
$var[] = $item;
if ($key >= 2)
break;
}
$gold = array_unique($var);
$array = array_reverse($array);
foreach ($array as $key => $item) {
if (!in_array($item, $tmp)) {
$tmp[] = $item;
} else {
$bronze[] = $item;
}
if ($key >= 2)
break;
}
$winners = array_merge($gold, $bronze);
$part = TourPlayoff::find()
->where(['tour_id' => $this->tour_id, 'user_id' => [$model->user1, $model->user2]])
->asArray()
->select([new Expression('max(part) part'), new Expression('team_id')])
->all();
<tbody class="ui-sortable">
<tr data-key="7" class="ui-sortable-handle"><td style="border-top:1px solid; ">1</td><td ><img src="/upload/images/team/586246181f77b.png" alt="" style="width:35px;height:35px;"> Zenit St. Petersburg - [ robot_dqaTH ] </td></tr>
<tr data-key="1" class="ui-sortable-handle"><td >2</td><td><img src="/upload/images/team/5894d64081ada.png" alt="" style="width:35px;height:35px;"> Amkar Perm - [ akula22 ] </td></tr>
<?php
use yii\helpers\Html;
use yii\helpers\HtmlPurifier;
$this->title = Yii::$app->name . ' / ' . $model->title;
$this->params['breadcrumbs'][] = ['label' => Yii::t('main', 'News'), 'url' => ['/post/default/index']];
$this->params['breadcrumbs'][] = ['label' => $model->parent->title, 'url' => ['/post/default/category', 'slug' => $model->parent->slug]];
$this->params['breadcrumbs'][] = $model->title;
$this->registerMetaTag(['name' => 'description', 'content' => $model->description]);
$this->registerMetaTag(['name' => 'keywords', 'content' => $model->keywords]);
?>
<div class="col-md-6">
<div class="well">
<div class="page-title"><h1><?= Yii::t('main', 'News') ?></h1></div>
<div class="box88">
<h1 class="title"><?= Html::encode($model->title) ?></h1>
<div class="pad10">
<?= Html::img($model->picUrl, ['class' => 'img-responsive']); ?>
</div>
<div class="pad10">
<?= HtmlPurifier::process($model->short); ?>
</div>
<div class="clear"></div>
...
<div class="pad5">
<?= HtmlPurifier::process($model->full); ?>
</div>
<div class="clear"></div>
<?php if (!empty($model->tagLinks)) : ?>
<div class="tags">
<b><?= Yii::t('main', 'Tags') ?></b>:
<?= $model->tagLinks ?>
</div>
<?php endif; ?>
<div class="author_panel">
<p><i class="fa fa-user-secret"></i> <?= $model->user->username ?> <i
class="fa fa-calendar-check-o"></i> <?= Yii::$app->formatter->asDate($model->created_at) ?></p>
</div>
<br/>
<?= \app\modules\comments\widgets\CommentWidget::widget(['model' => $model]) ?>
</div>
</div>
</div>