Okay,so your requirement is:
Display popup while calculation is going on with the remaining calculation detail.
Well, this code is just showing the popup with a message before ajax progress starts.And show the calculated details at success.And on completion of ajax call,hides the popup.
showPopup("Calculation is under process!");
$.ajax({
type: "POST",
url: "url of the web service where you are calculating",
data:
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
if (response.d.Code == globalItem.WebServiceStatus.Success) {
showPopup(response.d.ResponseItem[0]);
}
},
error: function (jqXHR, exception) {
},
complete: function () {
hidePopup();
}
});