I'm using Jquery Confirm when I trigger my ajax call I get a status response of 200 but my .done() and .fail() are firing simultaneously. Am I correct that .done() will fire if response received is 200?
var frameid = $('#frameID').val();
$('.change-frame').on('click', function (e) {
e.preventDefault();
$.confirm({
title: 'Changing your Base frame?',
content: 'Let us know what happened to it.<br><span>This will also delete your frame in our database</span>.',
animation: 'scale',
closeAnimation: 'scale',
draggable: false,
buttons: {
'Sold': {
text: 'I sold it',
btnClass: 'btn-dark',
action: function () {
$.ajax({
url: '/base-frame/delete',
data: {frameid},
dataType: 'json',
}).done(function(){
console.log('SUCCESS')
}).fail(function(){
console.log('FAILED')
});
}
},
'Traded': {
text: 'I traded it',
btnClass: 'btn-dark',
action: function () {
$.alert('You Traded your Frame');
}
},
Stolen: {
text: 'It was stolen',
btnClass: 'btn-dark',
action: function () {
$.alert('Sorry to hear that');
}
},
}
});
});
What am I doing wrong here?
UPDATE
Tried to force the response to 400 but still .done() and .fail() are firing simultaneously