This line on your javascript code adds everything on the same div, even if you have multiple divs, because you do not distinct the id of each div.
$("#file").html(response);
The solution is to add different ids on each div using the @item.Id
and then use that id to add the correct content on the correct id.
Eg add the id on the div
<div id="[email protected]">
</div>
then on javascript use the id to find that div.
function collapse(id) {
var id = id;
$.ajax({
type: "GET",
url: "/Document/GetFileList",
data:{id:id},
success: function (response) {
$("#file_" + id).html(response);
}
});
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…