I have the following code: $('#r_0_0').blur(function() {
var x = $('#r_0_0').val(); var y="#d_0"; $(y).empty(); $.get("apps/P5001/call/LineItems.lasso?LITM=" + x + "&Line=" + 'r_0_0' + "&TEST=" + y,function(data2){ $(y).empty(); $(y).append(data2); },"html"); $('#addnew').click(); }); The last line "#addnew" is adding a new line to a html table, and the other code is updating a div with information from a database call. It is all processing correctly, except the "addnew" is running before the database query. How can I get the "addnew" to wait for the prior commands to finish?