I am trying to retrieve data using $.post and store it as a return type. However, I always get an undefined error.
if I do something like:
function get_list(){
      $.post('php/reverse.php', function(data){
        alert(data);
      });
  }
everything works perfectly. But if I do something like
 function get_list(){
          $.post('php/reverse.php', function(data){
            return data;
          });
      }
alert(get_list()); 
Then it suddenly gives me an undefined error. Can someone tell me what I am doing wrong.
 
     
     
     
    