Created
March 16, 2013 05:36
-
-
Save mojaray2k/5175136 to your computer and use it in GitHub Desktop.
This is jQuery Ajax Template 2
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
<section id="confirm"> | |
<div class="flight-review"> | |
<table> | |
<tr> | |
<th>Base Price:</th> | |
<td id="price"></td> | |
</tr> | |
<tr> | |
<th>Gov Taxes:</th> | |
<td id="fees"></td> | |
</tr> | |
<tr> | |
<th>Trip Total:</th> | |
<td id="total"></td> | |
</tr> | |
</table> | |
</div> | |
</section> |
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 selectFlights(e){ | |
e.preventDefault(); | |
$('#tabs a.selected').removeClass('selected'); | |
$(this).addClass('selected'); | |
var flight = $(this).data('flight'); | |
var flightClass = $(this).data('class'); | |
$('confirm').hide(); | |
$.ajax('/flights' + flight, { | |
data: { 'class': flightClass }, | |
dataType: 'json', | |
success: showTotal | |
}); | |
} | |
function showTotal(json){ | |
$('#price').text(json.price); | |
$('#fees').text(json.fees); | |
$('#total').text(json.total); | |
$('#confirm').slideDown(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment