Skip to content

Instantly share code, notes, and snippets.

@matiskay
Forked from codeschool-courses/challenge-1-12.js
Created November 30, 2011 07:41
Show Gist options
  • Save matiskay/1408358 to your computer and use it in GitHub Desktop.
Save matiskay/1408358 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