我的代码:
<script type="text/javascript">
window.onload = function () {
$.post("/Game/GetPlayers", function (data) {
for (var i = 0; i < data.player.length; i++) {
if ("@Session.SessionID" == data.player[i].AgainstId);
{
//some code
}
$("<li></li>").text(data.player[i].Name).on("click", function () {
\*when i click - field hide */ $(this).hide();
$.post("/Game/SetId", { name: data.player[i].Name },function(data2) {
alert(data2);
});
}).prependTo("ol");
}
});
}
</script>
为什么我点击时标签(li)消失但第二个帖子请求不起作用?有可能(请求中的请求)吗?