Try with
checkPhoneNumber: function(attrs){
return $.ajax({
url: "http://hidden-oasis-1864.herokuapp.com/check-phone-number/"+attrs['country']+"/"+attrs['phone'],
success: function(response){
console.log('in checkPhoneNumber success');
},
error: function(){
console.log("I FOUND MY PROBLEM");
that.errors.push({input_tag: 'phone', error: 'There was an error validating the phone number'});
return that.errors;
}
});
},
It looks like the ajax call is returning an error, so done
never gets called.
To register a callback for failure, use fail
and to register a callback to always execute use then
.