I try to use a ajax result for a true/false return in a function, but it doesn't work. I have read all about the stuff here so i built the following code:
$( "#toolbox-tabs" ).on( "tabsbeforeactivate", function( event, ui ) {
   validateSession().done(function(r){
     if (r.session)
        return true;
     else
        return false;
   });
});
function validateSession() {
   return $.ajax({
    url: check.php,
    data: {
        session_check : true
    },
    type: 'POST',
    dataType: 'json'
  });
}
check.php is a simple print json_encode(array("session" => true/false)); The problem is that even if r.session is false, the on.function always returns true. Any help would be appreciated!
Kind regards, Matty
 
     
    