我试图在动作链接点击上运行Ajax,但我不知道为什么脚本不会在点击时触发
HTML / Razor
@Html.ActionLink(" ", "DeleteRecord", new { id = item.JPAppId }, new { @class = "fa fa-trash", id = "myLink" })
JQuery / Ajax
<script type="text/javascript">
$("#myLink").click(function (event) {
event.preventDefault();
$.ajax({
url: 'JPApplications/StudentIndex',
data: { id: $(this).data('id') },
success: function () {
alert("Value Deleted");
}
});
});