Tudor is a techie turned manager who fights like mad to keep his tech skills honed and relevant. Everything from web hosting, networking, *nix and the like. Constantly developing and co-ordinating with others to make the web a better (and easier to use) place.
Tuesday, 4th Jun 2013 Posted @ 09:08
I was having a nightmare loading some information using jQuery into a webapp.
This works:
function getTransactions() {However, the first request was taking 6-7ms but the second request was always taking 1.01s regardless of the order I put them.
var oAccount = document.getElementById('account').value;
$('#transtable tbody').load('api.php?action=gettransactions&account=' + oAccount);
$('#balancetable tbody').load('api.php?action=currentbalance&account=' + oAccount);
}
function getTransactions() {Now both requests complete in 8ms!
var oAccount = document.getElementById('account').value;
$('#transtable tbody').load('api.php?action=gettransactions&account=' + oAccount, function () {
$('#balancetable tbody').load('api.php?action=currentbalance&account=' + oAccount);
});
}
[ no comments : Add ]