init(); function init() { var lastid = 99; (function($) { $( document ).ajaxError(function() { $( ".log" ).text( "Triggered ajaxError handler." ); }); })(jQuery); var d = new Date(); var m = d.getMonth() + 1; var y = d.getFullYear(); generate(m,y); } function openCalendar(btnDate) { (function($) { var calendarModal = $('.modal-content'); $.post('/api/calendar/loadDay', { date: btnDate } , function(data) { calendarModal.replaceWith(data); console.log('Test'); }); })(jQuery); } function calendarOpen(myid) { var mydate = document.getElementById(myid).name; $(function() { var loadingDiv = $('#calendarmodalload'); $.get('/adminV2/assets/lib/calendar/calendarmodal.php?date='+mydate, function(data) { loadingDiv.replaceWith(data); console.log("Loading day: "+mydate); }); }); } function calendarEmptyDay(myid) { var mydate = document.getElementById(myid).name; $(function() { var loadingDiv = $('#calendarmodalload'); $.get('/adminV2/assets/lib/calendar/calendarEmptyDay.php?date='+mydate, function(data) { loadingDiv.replaceWith(data); console.log("Loading empty day: "+mydate); }); }); } function generate(pmonth,pyear){ (function($) { var mycalendar = $('.calendar'); $.post('/api/calendar/generate', { month: pmonth, year: pyear } , function(data) { mycalendar.replaceWith(data); console.log('Calendar Initialised'); }); })(jQuery); }