Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var $this = $(element);
- $(async function(){
- cal = $this.myCalendar(options);
- updateMonth();
- function loadDisabledDates( id, month, url, done) {
- $.getJSON( url, function( data ) {
- done(data);
- });
- }
- var calendarURL = createCalendarURL(currentId, cal.getMonth());
- // CALLBACKS
- loadDisabledDates(currentId, cal.getMonth(), calendarURL, function (data) {
- disableUnavailableDates($this, data, cal.getYear(), cal.getMonth());
- });
- // PROMISES
- loadDisabledDatesWithPromise(currentId, cal.getMonth(), calendarURL)
- .then(function (data) {
- // stuff in here
- })
- .catch(function (error) {
- // stuff with errors here
- });
- // ASYNC / AWAIT
- let data;
- try {
- data = await loadDisabledDatesWithPromise(currentId, cal.getMonth(), calendarURL)
- } catch (error) {
- console.log(error);
- }
- console.log(data)
- });
Add Comment
Please, Sign In to add comment