<?php
/** @var $this yii\web\View */
$this->registerMetaTag(['name' => 'csrf-param', 'content' => Yii::$app->request->csrfParam]);
$this->registerMetaTag(['name' => 'csrf-token', 'content' => Yii::$app->request->getCsrfToken()]);
?>
<form action="#" method="posts">
<!-- inputs -->
<input type="hidden" name="<?= Yii::$app->request->csrfParam ?>" value="<?= Yii::$app->request->getCsrfToken() ?>"/>
<!-- submit -->
</form>
dataType: 'json'
в ajax запросе.$.ajax({
url: 'http://www.google.com',
type: 'get',
dataType: 'jsonp',
success: function(data) {
// data = { response: '...' }
var el = $(data.response).find('#id').html();
$('div').html(el);
}
});
$.ajax({
url: 'https://toster.ru/q/331984',
dataType: 'html' ,
type: 'get',
success: function(data) {
var el = $(data).find('h1.question__title');
$('body').html(el);
}
});
class MyBigClass
{
var $allocatedSize;
var $allMyOtherStuff;
}
function AllocateMyBigClass()
{
$before = memory_get_usage();
$ret = new MyBigClass;
$after = memory_get_usage();
$ret->allocatedSize = ($after - $before);
return $ret;
}
'use strict';
var interval
var titles = ['Title 1', 'Title 2', 'Title 3'];
var len = titles.length;
var i = 0;
function changeTitle(title)
{
document.title = title;
}
interval = setInterval(function() {
if(i < len) {
changeTitle(titles[i++]);
} else {
clearInterval(interval);
}
}, 1000);