how can use of a function in several ajax call?
<p>For avoid repeating i want a function use in several ajax call. how is it?<p>
<strong>Like:</strong></p>

<pre><code>//use of content this function in other function(ajax call)
$(function num_bg () {
    var total = $('.pag a', '.ser').size();
    if (total == 0) {
        $('.number').css('display','none');
    }
});

// First ajax call
    function pagination(e) {
    e.preventDefault();
    var dataObj = $('form').serialize();
    $.ajax({
        type: "POST",
        dataType: "html",
        url: 'dirc',
        data: dataObj,
        cache: false,
        success: function (html) {
            var $html = $(html);
                $('#num_count').replaceWith($html.find('#num_count'));
                $('tr#paginate').replaceWith($html.find('tr#paginate'));
                $('.pagination').replaceWith($html.find('.pagination'))
                $('#erro_find').remove();

        num_bg (); // This is same function above (this don't work)
        }
    });
    return false;
}
$('form').live('change', pagination);
$('.pag a').live('click', pagination);
$('#input').live('keyup', pagination);


 //Second ajax call
$('#delete').click(function(e){        
    e.preventDefault();
    $.ajax({
        type: "POST",
        url: 'diuarsl',
        data: dataString,
        cache: false,
        success: function(html){
            var $html = $(html);                       
                    $('#num').replaceWith($html.find('#num_count'));
                    $('tr#pag').replaceWith($html.find('tr#paginate'));
                    $('.pag').replaceWith($html.find('.pagination'));

                num_bg (); // This is same function above (this don't work)
                }
        }
    })
});
</code></pre>
