This bit here:
$.ajax({
url: "@Url.Action("loadShipment", "ManualBooking")",
method: "GET",
data: DataObjectForAjaxCall,
async: false,
success: function (Result) {
$('.modal-body').html(Result);
}
});
is asynchronous. You tell it what do to and it goes off and runs.
The next line:
$("#hideLoader").click();
runs just after you tell the ajax call what to do, not when it completes. That happens elsewhere.
Once the async ajax call has been complete, it runs this:
success: function (Result) {
$('.modal-body').html(Result);
}
but only if it succeeds.
Add your hide in there.
Also include an
error: function () {
}
to catch when the process failed. You don't want the modal item to remain if the process failes