Maybe there is no difference, but is either way better than the other (or perhaps a mysterious 'third' way better than both!)...
first:
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));
});
});
second:
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));
});
});