var xhr = new XMLHttpRequest(),
body = 'name=Doxi';
xhr.open("POST", '/submit', true)
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
xhr.send(body);
( (int)27923 )
function getAttachmentsPost($post_id = 0) {
$args = array(
'post_parent' => $post_id,
'post_type' => 'attachment',
'post_mime_type' => 'image',
'posts_per_page' => -1,
);
if ( $attachments = get_children( $args ) ) {
return $attachments;
}
return [];
}
https://taxi.yandex.ru/3.0/routestats/
var tabBgColor = ['#f13640', '#0096c8', '#89b600', '#9f5200', '#f6a11c', '#a539b5'];
$(window).scroll(function () {
colorOnScroll();
});
colorOnScroll();
function colorOnScroll(){
var scrollTopValue = $(window).scrollTop();
var tabSectionOffsetTop = [];
$.each($(".filet"),function(k,v){
var sectionOffsetTop = $(this).offset().top + ($(this).height() / 2);
tabSectionOffsetTop.push(sectionOffsetTop);
});
if(scrollTopValue<tabSectionOffsetTop[0]){
$('body').stop().animate({ backgroundColor: tabBgColor[0] });
}else{
for(var i=0; i<tabSectionOffsetTop.length;i++){
if(scrollTopValue>tabSectionOffsetTop[i] && scrollTopValue<tabSectionOffsetTop[i+1]){
$('body').stop().animate({ backgroundColor: tabBgColor[i+1] });
}
}
}
}
$string = '[{"count":1,"img":"/img/789.jpg","title":"Перчатки трикотажные","price":8,"id":"197299_65366_2"}]';
$array = json_decode($string, true);
/*
Array
(
[0] => Array
(
[count] => 1
[img] => /img/789.jpg
[title] => Перчатки трикотажные
[price] => 8
[id] => 197299_65366_2
)
)
*/
function getCookie(name) {
function escape(s) { return s.replace(/([.*+?\^${}()|\[\]\/\\])/g, '\\$1'); };
var match = document.cookie.match(RegExp('(?:^|;\\s*)' + escape(name) + '=([^;]*)'));
return match ? match[1] : null;
};
var cities = [{ "CityId": 781, "Name": "Санкт-Петербург", "RegionId": 58 }],
currentCity = cities.filter(function(data) {
var currentCityId = getCookie('CityId');
return data.CityId == currentCityId;
});
console.log(currentCity);