I want to return the following response from my jquery code.
function count_waiting(){   
    $.ajax({                                                    
      url: 'index.php/event/count_waiting/2',                           
      type: "post", 
      success: function(response) {         
       return response;     
      } 
    });
}   
By doing this the return is undifned
$(document).ready(function() {
  alert(count_waiting());
});
any idea whats wrong with my code
 
     
    