每次用户单击图像时,如何在我的 javascript 中获取确切的“PostId”值
for (int i = 0; i < Model.Count; i++)
{
<img src="/images/icon_edit.gif" width="22" height="19" class="Edit" itemid="post" />
@Html.HiddenFor(x => x[i].PostId, new { @class = "postnew" })
}
JS:
$(document).ready(function () {
$('.Edit').click(function () {
alert($("#post").val());
var params = { uname: $(this).val() };
$.ajax({
url: "/Profile/Post",
type: "Get",
data: { id: $("#post").val() }
});
});
});