I have a function that if returned true displays a message and if returned false it doesn't display it.
So i am trying to with the help of ajax check my database if the user should have the message displayed or not. This is what i got right now that is not working, the response goes into the if reponse == true but the return does nothing.
exports.show_message = function callback(response){
if (response == true) return true;
else if(response == false) return false;
$.ajax({
type: 'GET',
url: "/account/show_msg/",
success: function(data) {
if (data) data = false;
else data = true;
callback(data);
},
});
};
As mentioned it goes into response true but the return true; does nothing. However it works to just call the return true and ignore all checks
exports.show_message = function callback(response){
return true;
};