I am using Ajax call where ajax method success is called before completion of first Ajax method.I have to call first Ajax method then its success should be called then second Ajax call sucess should be called and so on.
function CallAjaxMethod(){
$.ajax({
async: false,
type: "POST",
url: "pgName.aspx/fun1",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
CallAjaxMethod1();
}, complete: function () {
},
failure: function (response) {
}
});
}
function CallAjaxMethod1(){
$.ajax({
async:false,
type: "POST",
url: "pgName.aspx/fun2",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
CallAjaxMethod2();
}, complete: function () {
},
failure: function (response) {
},
error: function (error) {
}
});
}