Atms.ExpressCheckout = { loadPriceList: function ($container, scheduleId, callback) { $.ajax({ url: "atms/uc/services/pricingservice.aspx?sch=" + scheduleId, type: "GET", global: false // Set to false to prevent the "Loading" spinner in case we need to revert back to calendar view. }).done(function (result) { $container.html(result); if (callback) callback(); }); }, init: function () { var $calendar = $(".js-calendar-container"); var $purchaseContainer = $("#PurchaseContainer"); var $pricing = $("#PricingContainer"); $calendar.on("click", ".js-select-date", function () { var $this = $(this); var scheduleId = $(this).data("schedule"); if ($this.text().trim().toLowerCase() === "sold out") { return false; } $("#ScheduleId").val(scheduleId); Atms.ExpressCheckout.loadPriceList($pricing, scheduleId, function () { // Hide the calendar $calendar.hide(); // Set the selected date $pricing.find(".js-selected-schedule span.title").html($this.data("scheduledate")); // Show the rest of the form $purchaseContainer.show(); }); return false; }); $purchaseContainer.on("click", "h2.js-selected-schedule .change", function () { $purchaseContainer.hide(); $calendar.show(); return false; }); } };