I have an a table. When i clicked the table rows , after that ajax request functions are called and then more than one tables load. I want to show spinner while ajax methods run. So that i write code like as below.
$(".table-row").click(function (evt) {
ShowSpinnerFuntion();
var $cell = $(evt.target).closest('td'), msg;
var id = $cell.attr("id");
CallAjaxMethodForTable1(id);
CallAjaxMethodForTable2(id);
CallAjaxMethodForTable3(id);
CallAjaxMethodForTable4(id);
});
When i execute this click function, spinner is shown after all tables are load with ajax requests. Namely ajax methods run before "ShowSpinnerFuntion()" method although i call method (show spinner) first.
I write only show spinner function in this click function method.Like as:
$(".table-row").click(function (evt) {
ShowSpinnerFuntion();
var $cell = $(evt.target).closest('td'), msg;
var id = $cell.attr("id");
//CallAjaxMethodForTable1(id);
//CallAjaxMethodForTable2(id);
//CallAjaxMethodForTable3(id);
//CallAjaxMethodForTable4(id);
});
When i execute click function like as above, after that spinner is shown directly. How can i execute spinner function before ajax request functions. How can i give priority to this javascript functions.