I have below code which is working fine. I have to run two different server side function (which can not be run on the same time i have differentiated).
- Default.aspx/AddCart
- btnUpdate Click Event
My Problem is alert box coming & loading div(#overlay) is hiding before btnUpdate Click Event completion. I dont want to come alert message box & want to show loading div until Click Event not completed.
$("#overlay").show();
$.ajax({
type: "POST",
url: "Default.aspx/AddCart",
data: "{id: " + selectValue + ", qty:" + qq + "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (r) {
document.getElementById("<%= btnUpdate.ClientID %>").click();
alert("Added to Shopping Cart !");
$("#overlay").hide();
},
error: function (r) {
alert(r.responseText);
$("#overlay").hide();
},
failure: function (r) {
alert(r.responseText);
$("#overlay").hide();
}
});
#overlay
div after that call is completed. – Spluf