<?php
$events[] = array('title'=>'Jimmy\'s Birthday','start'=>'2018-04-01','end'=>'2018-04-01','location'=>'');
$events[] = array('title'=>'E-Waste Recycle Day','start'=>'2018-04-12T07:00:00-06:00','end'=>'2018-04-13T15:00:00-06:00','location'=>'Recycle Center');
$events[] = array('title'=>'Breakfast','start'=>'2018-04-18T06:00:00-05:00','end'=>'2018-04-18T07:00:00-05:00','location'=>'');
$events[] = array('title'=>'Wash Car','start'=>'2018-04-18T08:00:00-05:00','end'=>'2018-04-18T09:00:00-05:00','location'=>'');
$events[] = array('title'=>'Read Up On Rocket Science','start'=>'2018-04-18T09:00:00-05:00','end'=>'2018-04-18T10:00:00-05:00','location'=>'');
$events[] = array('title'=>'Build The Projectile','start'=>'2018-04-18T13:00:00-05:00','end'=>'2018-04-18T13:30:00-05:00','location'=>'');
$events[] = array('title'=>'Launch The Missile','start'=>'2018-04-18T18:00:00-05:00','end'=>'2018-04-18T20:00:00-05:00','location'=>'');
$events[] = array('title'=>'Labor Day','start'=>'2017-09-07','end'=>'2017-09-07','location'=>'');
$events[] = array('title'=>'Subliminal Closing Party','start'=>'2017-09-30','end'=>'2017-10-01','location'=>'Pacha - Ibiza, Spain');
// header('Content-type: application/json');
echo '{"data":' . json_encode($events) . '}';
?>
var request = new XMLHttpRequest();
request.open('GET', 'eventFeed.php', true);
console.log('request = ', request);
request.responseType = 'json';
request.send(null);
request.onload = function () {
var data = this.response.data;
for (var i = 0; i < data.length; i++) {
console.log(data[i].title + ' is a ' + data[i].start + '.');
}
if(!request.response.data) {
console.log('request.response.data is missing');
} else {
console.log('data = ', data, "\n",
new Calendar({
calContainer:'calBody',
newDate:'02/05/2009',
cEvents: data
}), Array.isArray(data));
}
}
<?
if(!empty($_GET['city'])) $_SESSION['city'] = $_GET['city'];
else {
// Выводим контент
}
?>
<script>
ymaps.ready(function(){
var geolocation = ymaps.geolocation;
$('#city').text('Город: '+geolocation.city);
$.ajax({
type: "GET",
url: "?city='" + YMaps.location.city,
data:{
city: YMaps.location.city,
},
});
});});
</script>