, ajax- , ajax. (, ..), ajax
Edit:
public string UpdateVoteScore(int postId, int value) {
return "success";
}
JavaScript:
var UpdateScore = function(postId, newValue) {
$.ajax({
type: "POST",
url: /YourController/UpdateVoteScore,
data: { postId: postId, value: newValue },
success: function(result) {
$("#MyImage" + postId).attr("src", "some new image path here");
},
error: function(req, status, error) {
}
});
}
:
<img id='<%= "MyImage" + post.Id %>'
src="some image path"
onclick="UpdateScore(scoreValueHere);"></img>
: post , , post.Id , ,