Created
August 5, 2014 14:57
-
-
Save paulca/af35e94a3d16dbf623d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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