function canDeleteFacilitator(facilitatorId, handleData) {
var call = $.ajax({
type: 'GET',
url: urls.candeletefacilitator,
data:{facilitatorId: facilitatorId}
}).done(function (data) {
return handleData(data);
})
}
var canDeleteText = "";
canDeleteFacilitator(facilitator.value, function (canDelete) {
console.log(canDelete);
if (canDelete == true) {
canDeleteText = '<button class="badge btn-danger p-2" id="deleteFacilitator" type="button"><i class="fas fa-exclamation-triangle"></i>Delete Permanently</button>';
}
})
console.log(canDeleteText);
canDeleteText does not get set within the callback function. How do I correct this scope?