The Loop problem in jQuery

when I click the View button to select the id of a certain piece of data in the table, I request multiple pieces of data according to id, and use each loop to render. After clicking, the next click will accumulate the last information
this is the code I wrote:

/ / data request for viewing the product details page of the data
function productDatas (orderNum,type) {

    $.ajax({
        type: "post",
        data: {orderNo: orderNum},
        url: "/manages/order/query_orderno",
        success: function (data) {
            var item="";
            console.log(data);
            var goodsDatas=data.data.detailList;//goodstype
            console.log(data.data.detailList);
            $.each(goodsDatas,function(i,result){  ///<button type="button" id="lookOrderDatas" class="btn btn-primary"></button>
                item += "<tr height="50"><td>"+result.goodstitle+"</td><td>"+result.goodsid+"</td><td>"+result.quantity+"</td><td>"+result.totalprice+"</td><td  style="width: 80px" ><button type="button" id="lookOrderDatas" class="btn btn-primary" style="display: none"></button></td></tr>";
                if(result.goodstitle==1){
                    $("-sharplookOrderDatas").css("display","block");
                }
            });
            $("-sharpproductDatas").append(item);
        }
    })

}

this is my picture

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)

what result do you expect? What is the error message actually seen?

Apr.11,2021

Don't understand too much. Circle the key code. What is the problem and what result do you want?


you should first clear out adding


does it mean that the pop-up dialog content is cumulative? $('- sharpproductDatas') Please execute empty before append.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ee41-2c479.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ee41-2c479.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?