I have two java-script function. In one function i have called another function. Its working fine. But the problem is first function not getting response from second java script. I have requirement if the first function return true then second will execute rest code.
My Code.
function NextData() {
var lQIndex = $('#hfLastQIndex').val();
if (SaveData(lQIndex)) {
alert('1111111');
//Rest Code....
}
}
function SaveData(QNo) {
var flag = false;
$.ajax({
url: '/Assessment/Save',
type: 'POST',
data: {A:QNo},
async: false,
success: function (data) {
//alert("Test: " + data.result);
if (data.result == "T")
flag = true;
},
error: function (req, status, error) {
//alert("R: " + req + " S: " + status + " E: " + error);
alert('Unable to connect server!');
return false;
}
});
return flag;
}