I have dropdown on page with this menu item:
<li><a onclick="return false" href="javascript:void(0)" class="change-state" data-id="@Model.Id" data-state="@ReportStatus.New">Mark as New</a></li>
And I have jquery event handler for click on this <a>
$(function () {
$('.change-state').click(function () {
var attr = this.dataset;
$.ajax({
method: 'POST',
url: '@Url.Action("ChangeReportStatus", "Default")',
data: { id: attr.id, status: attr.state },
success: function (data) {
var name = '#report-number-' + attr.id;
$(name).html(data);
}
});
});
});
And when I open my page, click this <a>
I have changes by ajax, but if I try to click it again, nothing works. I think it's because I using javascript:void(0)
, but without this my ajax refresh all page, not only element. Please help me to solve this issue.