I want to make $.get() method synchronous in my function. In ajax aysnc : false
helps me, now how do i do the same to to $.get()
var ifsc_code = $('#ifsc-code').val();
var api_url = 'http://api.techm.co.in/api/v1/ifsc/'+ifsc_code;
$.get(api_url, function(data, status){
//console.log(data.status);
var status = data.status;
if (data.status == "success") {
$.each(data,function(key,value){
var address = value.BANK+", " + value.BRANCH+", " + value.ADDRESS ;
$('.bank-details').removeClass('no-ifsc').text(address);
});
var res = "true";
alert('inside checkIfsc true');
return res;
}
else if (data.status == "failure") {
$('.bank-details').addClass('no-ifsc').text(data.message);
var res = "false";
alert('inside checkIfsc false');
return res;
}
Or is there any other approach to do the same ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…