Why can not access parameter of parent ajax call into child ajax call

I retrieve data from data from database using ajax call. In my code can not access parameter of parent ajax call request to child ajax request call. I can see error in compiler. I can try to put asyc: false in child request but using async i can access parameter but child ajax call only work one time.

Here down is my code

$.ajax({
        type: "GET",
        url: "/meetzen/comments",
        data: {  acId: accountId, pstId: postId },
        success: function(res) {
            // res.lenth = 2
            for (var i = 0; i < res.length; i++) {
                $.ajax({
                    type: "GET",
                    url: "/meetzen/getlikeornotimgzoom",
                    data: {commentId: res[i].comment_id},
                    success: function(likeornot){
                        
                        if(likeornot == 0)
                        {
                            $("#btnlikeornot").append("<button type = 'submit' onclick ='btncommentunlike("+res[i].comment_id+")' id='commentunlikebtn"+res[i].comment_id+"' data-id='"+res[i].u_id+" ' class='comment-like-button-style'>" +
                                                "<img src='https://img.icons8.com/material-outlined/24/000000/like--v1.png'/>" +
                                            "</button>");
                        }
                        else
                        {
                            $("#btnlikeornot").append("<button type = 'submit' onclick ='btncommentlike("+res[i].comment_id+")' id='commentlikebtn"+res[i].comment_id+"' data-id='"+res[i].u_id+" ' class='comment-like-button-style'>" +
                                                "<img src='https://img.icons8.com/material-rounded/24/fa314a/like.png' />" +
                                            "</button>");
                        }
                    }
                });
            }
       }
});

Error

imagezoom.js:68 Uncaught TypeError: Cannot read properties of undefined (reading 'comment_id')
    at Object.success (imagezoom.js:68)
    at i (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)
    at A (jquery.min.js:4)
    at XMLHttpRequest.<anonymous> (jquery.min.js:4)