I stuck in very simple situation.
I have a link that execute ajax call and on success I need to change clicked link text or color.
foreach (var m in Model.GroupPosts){
...
@Html.ActionLink("Vote up", "Vote", "GroupPost", new { groupPostId = m.GroupPostId }, new{@class="vote-up"})
@Html.ActionLink("Vote down", "Vote", "GroupPost", new { groupPostId = m.GroupPostId }, new { @class = "vote-down" })
}
$('.vote-up').click(function (e) {
e.preventDefault();
var url = $(this).attr('href');
$.ajax({
url: url,
type: "GET",
success: function (html) {
alert("voted up");
e.target.text("New link text");
}
});
});
I can't change clicked link text.