var preadd = $.ajax({
type: 'POST',
url: url,
data: {
some data
},
success: function(output) {
if (output != 12 && output != 13) {
some code here...
var arr = [];
arr.push.apply(arr, val.split(","));
arr.splice(-1, 1);
for (var i = 0; i < arr.length; i++) {
arr[i] = arr[i].trim();
}
chk dup1 is another ajax
function outside
var chk = chkdup1();
console.log(chk);
chk.then(function() {
if (result == 13) {
rem = confirm("Duplicate data will be removed, are you sure!");
if (rem == false) {
return false;
}
if (rem == true) {
remdens1();
}
}
});
}
if (output == 13) {
rem = confirm("Duplicate data will be removed, are you sure!");
if (rem == true) {
remdens1();
}
}
if (output == 12) {
$('#valensdata').html("success").css('color', 'green');
}
return rem;
}
});
preadd.then(function() {
console.log(rem);
if (rem == false) {
return false;
}
fnensadd();
});
- even if i press cancel in confirm inside .then function of preadd,
- i am unable to get the value stored inside rem variable.
- preadd.then at the bottom function is executing even when return false.
can anyone kindly guide me.