Pass Success variable to code
- by João Dias
How can I pass a variable that has been calculated in the success callback of an ajax function, to the document.ready ?
I have this code
 function loadActions()
        {
            var countDiv;
            $.ajax({
                type: "POST",
                cache: false,
                url:"modules/actions/actions.php",      
                success : function (data) {
                    $("#actions-container").html(data);
                    $('.action-details').hide();
                    countDiv = $('.action-tab-odd').length + $('.action-tab-even').length ;
                }
            });
            return countDiv;
        }
   $(document).ready(function(){
        var count = loadActions();
   });
But count is allways undefined. How can I get this to work?
Thank you