<script src="//site.local/gt/q35SRtCaC7uTKo4wice8PuDf3cvaXHc46" charset="utf-8" type="text/javascript" async></script>
<div id="q35SRtCaC7uTKo4wice8PuDf3cvaXHc46"></div>
public function actionSomeNews()
{
SomeNews::register($this->view);
return $this->renderAjax('somenews');
}
let text = 'Сюда можно писать html код';
let div = document.getElementById('q35SRtCaC7uTKo4wice8PuDf3cvaXHc46');
div.innerText = text;
<script src="/gt/somenews.js"></script>
public function actionSomeNews()
{
echo "<script>let text = 'Сюда можно писать html код';
let div = document.getElementById('q35SRtCaC7uTKo4wice8PuDf3cvaXHc46');
div.innerText = text;</script>";
}
<?= ColorPicker::widget([
'model' => $model,
'name' => 'border_color',
'value' => '#3d1b1b',
'options' => [
'style' => 'width:90px;',
'id' => 'border_color'
]
]);?>
$.ajax({
type: 'POST',
data: {'sum': sum},
headers: {
'X-CSRF-Token': yii.getCsrfToken()
},
url: '/news/some-news',
dataType: 'json',
cache: false,
success: function (result) {
console.log(result)
},
error: function (jqXHR, textStatus, errorThrown) {
setShowCalls( all );
}
});
public function actionSomeNews()
{
if(!Yii::$app->request->isAjax)return;
$sum = Yii::$app->request->post('sum');
$model = News::getSomeNews($sum);
return $this->renderAjax()('some_news, [
'model' => $model,
]);
}
Не получилось, но это находит скрипт