Comments (1)
In PHP example:
if($_GET['json']){
header('Content-Type: application/json');
$dbc = new DataBase();
$stmt = $dbc->connect()->prepare("SELECT * FROM `calendar` ORDER BY `Date` ASC");
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
$json = array();
if(!empty($result)){
foreach($result as $row){
$json[] = array(
$row['Date'] => array(
'content' => $row['content'],
'repeat' => $row['repeats'],
'allDay' => $row['allDay'],
'endDate' => $row['endDate'],
),
);
}
}
$dbc->disconnect();
echo json_encode($json);
exit();
}
and JS example:
function ajaxCalendar(){
$.get('hand.php', {json:1}, function(data){
var result = {};
data.forEach(function(v,i){
result[Object.keys(v)] = Object.values(v);
});
$('#calendar').calendario({
caldata: result,
displayWeekAbbr: true,
events: ['click', 'focus']
});
});
}
ajaxCalendar();
from calendario.
Related Issues (20)
- feature request HOT 2
- The problem of startingDay HOT 1
- Block Multiple Dates HOT 1
- months go missing HOT 1
- Show multiple months HOT 1
- How to disable past dates in Calendario.js and How to color or mark every Sunday or any specific day in Calendario HOT 2
- Can't send date to js HOT 1
- _checkUpdate is calling for a file with "text/plain" mime type HOT 1
- How can we give different color for days based on holidays and off days. HOT 4
- How can we load events month wise only when that month is selected HOT 3
- Add a data attribute to dates
- language HOT 1
- How to add events to a date
- startday as sunday auto loads events when page loads
- calender destroy and re-init calender
- Add event to every day HOT 1
- How do I add events to the codrops calendario? I am new to jquery and php
- Incorrect month start date in IE/Edge in demo HOT 2
- Prevoius dates from today
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from calendario.