function generateNotify(message, type) { // type = danger, warning, info, successs $.notify({ // options message: message }, { // settings type: type, animate: { enter: 'animated bounceInDown', exit: 'animated bounceOutUp' }, newest_on_top: true }); } function checkJsonResponse(response) { if (response.result === true) { return true; } else { generateNotify(response.message, "warning"); return false; } }