Skip to content

Instantly share code, notes, and snippets.

@mojaray2k
Created March 16, 2013 05:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mojaray2k/5175136 to your computer and use it in GitHub Desktop.
Save mojaray2k/5175136 to your computer and use it in GitHub Desktop.
This is jQuery Ajax Template 2
<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>
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