removed the callback if false

This commit is contained in:
Diego Najar 2019-05-09 17:21:32 +02:00
parent 07df697618
commit 7c1db136b1
1 changed files with 7 additions and 3 deletions

View File

@ -8,7 +8,7 @@ class bluditAjax {
ajaxRequest.abort(); ajaxRequest.abort();
} }
if (content.length<100) { if ((content.length<100) && callBack) {
return false; return false;
} }
@ -25,12 +25,16 @@ class bluditAjax {
ajaxRequest.done(function (response, textStatus, jqXHR) { ajaxRequest.done(function (response, textStatus, jqXHR) {
console.log("Bludit AJAX: autosave(): done handler"); console.log("Bludit AJAX: autosave(): done handler");
callBack("Autosave success"); if (callBack) {
callBack("Autosave success");
}
}); });
ajaxRequest.fail(function (jqXHR, textStatus, errorThrown) { ajaxRequest.fail(function (jqXHR, textStatus, errorThrown) {
console.log("Bludit AJAX: autosave(): fail handler"); console.log("Bludit AJAX: autosave(): fail handler");
callBack("Autosave failure"); if (callBack) {
callBack("Autosave failure");
}
}); });
ajaxRequest.always(function () { ajaxRequest.always(function () {