Created
March 16, 2013 05:23
-
-
Save mojaray2k/5175104 to your computer and use it in GitHub Desktop.
This is a jQuery Ajax Template 1
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
var fetchingFlights = null; | |
function showFlights(e){ | |
$('tabs div').hide(); | |
$(activeDiv).show(); | |
var flight = $(this).data('flight'); | |
var flightClass = $(this).data('class'); | |
if(fetchingFlights.abort){ | |
fetchingFlights.abort(); | |
} | |
var fetchingFlights = $.ajax('/flights', { | |
data: { date: activeDiv }, | |
timeout: 8000, | |
cache: false, | |
beforeSend: function(){ | |
$('error').hide(); | |
$('loading').show(); | |
}, | |
complete: function(){ | |
$('loading').hide(); | |
}, | |
success: function(result){ | |
$(activeDiv).html(result); | |
$(activeDiv).show(); | |
}, | |
error: function(result){ | |
if(result.statusText != 'abort'){ | |
$('#tabs #error').show(); | |
} | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment