after ajax call javascript oncall function no work

1.After ajax call,how to make javascript oncall work?
index.php

#this code no work 
        function sortTable(columnName){
        var sort = $("#sort").val();
        $.ajax({
            url:'fetch_details.php',
            type:'post',
            data:{columnName:columnName,sort:sort},
            success: function(response){
           
                $("#empTable tr:not(:first)").remove();
                
                $("#content").append(response);
                if(sort == "asc"){
                    $("#sort").val("desc");
                }else{
                    $("#sort").val("asc");
                } }});}

#this code work well

function getresult(url) {
    $.ajax({
        url: url,
        type: "GET",
        data: { rowcount: $("#rowcount").val() },
        success: function(data) {
            $("#pagination").html(data);
             
        },
        error: function() { }
    });
}

2.here work well if oncall itself only but when combine others can’t work

function scrollToTop() {
        window.scrollTo(0, 0);
      }



#here is print side
<div id="pagination">
<input type="hidden" name="rowcount" id="rowcount" />
</div>

<script>
getresult("getresult.php");
</script>

getresult.php

$output .='<th><span sortTable("cus_code");scrollToTop();>Code</span></th>';
print $output;

After ajax successful call,the onclick javascript no working
but when onlick scrollToTop only no problem