humhub/resources/user/followButton.js
2016-02-24 02:50:16 +01:00

25 lines
786 B
JavaScript

$(document).on('click', '.unfollowButton', function (event) {
var userId = $(this).data("userid");
$.ajax({
url: $(this).attr("href"),
type: "POST",
success: function () {
$(".unfollowButton[data-userid='" + userId + "']").hide();
$(".followButton[data-userid='" + userId + "']").show();
}
});
event.preventDefault();
});
$(document).on('click', '.followButton', function (event) {
var userId = $(this).data("userid");
$.ajax({
url: $(this).attr("href"),
type: "POST",
success: function () {
$(".unfollowButton[data-userid='" + userId + "']").show();
$(".followButton[data-userid='" + userId + "']").hide();
}
});
event.preventDefault();
});