Skip to content

Instantly share code, notes, and snippets.

@paulca
Created August 5, 2014 14:57
Show Gist options
  • Save paulca/af35e94a3d16dbf623d7 to your computer and use it in GitHub Desktop.
Save paulca/af35e94a3d16dbf623d7 to your computer and use it in GitHub Desktop.
$(function() {
// Request ticket release info from Tito API and template it into the page, if available.
var target = $("#barebones-registration"),
conferenceService = $.tito('bocoup/backboneconf'),
ticketTemplate = _.template($("#ticket-template").html());
conferenceService.releases().then(function(r) {
var ticketForm = $(ticketTemplate({
releases: r
}));
target.replaceWith( ticketForm );
$.tito.start();
ticketForm.on("submit", function(e) {
e.preventDefault();
var url = ticketForm.attr('action'),
data = ticketForm.serialize();
if (TitoMachine.mobile() || !window.postMessage) {
ticketForm.attr("target","_blank")[0].submit();
} else {
TitoMachine.load(url, data)
}
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment