Tal vez no hay ninguna diferencia, pero de cualquier manera es mejor que el otro (o tal vez una misteriosa 'tercer' mucho mejor que los dos!) ...jQuery debería usar múltiples ajaxStart/ajaxStop manejando
primero:
var startTime;
$(document).ready(function() {
$("#lbl_ajaxInProgress").ajaxStart(function() {
// store the current date/time...
startTime = new Date();
// update labels
$(this).text('Yes');
$("#lbl_ajaxCallTime").text("-");
});
$("#lbl_ajaxInProgress").ajaxStop(function() {
// update labels
$(this).text('No');
$("#lbl_ajaxCallTime").text(myFunctionThatCalculatesTime(startTime));
});
});
Segundo:
var startTime;
$(document).ready(function() {
$("#lbl_ajaxInProgress").ajaxStart(function() {
// update labels
$(this).text('Yes');
});
$("#lbl_ajaxInProgress").ajaxStop(function() {
// update labels
$(this).text('No');
});
$("#lbl_ajaxCallTime").ajaxStart(function() {
// store the current date/time...
startTime = new Date();
// update labels
$(this).text("-");
});
$("#lbl_ajaxCallTime").ajaxStop(function() {
// update labels
$(this).text(myFunctionThatCalculatesTime(startTime));
});
});
A partir de jQuery 1.8, el método .ajaxStart() debe ser adjunto al documento. – ThdK