Skip to content

Instantly share code, notes, and snippets.

@codeschool-courses
Created November 9, 2011 21:03
Show Gist options
  • Save codeschool-courses/1353020 to your computer and use it in GitHub Desktop.
Save codeschool-courses/1353020 to your computer and use it in GitHub Desktop.
function setSeat(e, handler) {
e.preventDefault();
$('.selected').removeClass('selected').click(handler);
$(e.target).addClass('selected').unbind('click', handler);
$('#seatSelected').text($(e.target).data('seat'));
}
function selectFirstClass(e) {
setSeat(e, selectFirstClass);
var resulting_html = fetchFirstClassConfirm();
$('#confirm-first-class').html(resulting_html);
$('#confirm-first-class').show();
}
function selectSeat(e) {
setSeat(e, selectSeat);
$('#confirm-seat').show();
$('#confirm-first-class').hide();
}
function fetchFirstClassConfirm() {
// AJAX is called here, but we haven't learned that yet
// This returns the a.confirm-upgrade link (trust me)
}
function confirmUpgrade(e) {
e.preventDefault();
$('#confirm-first-class').hide();
$('#confirm-seat').show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment