jquery onclick doesn't work on adding another id and removing the old id
//You need to use event-delegation, because you are register a event-listiner on an element that not exist by that time.
$('#unfollowAnchor').on("click", function(e){
//has to be
$(document).on("click", '#unfollowAnchor',function(e){