$(document).ready(function () {
    $(document).on('click','#unfollow', function () {
        var loadUnfollow = changeFollowBusiness('unfollow');
    });
    $(document).on('click','#follow', function () {
        var loadFollow = changeFollowBusiness('follow');
    });
});

function changeFollowBusiness(arg) {
    var businessID = $("#businessID").val();
    if (arg == 'unfollow') {
        $("#unfollow").attr('value', lblFollowThisBusiness);
        $("#unfollow").attr('title', lblFollowThisBusiness);
        $("#unfollow").attr('id', 'follow');
    } else {
        $("#follow").attr('value', lblUnfollowThisBusiness);
        $("#follow").attr('title', lblUnfollowThisBusiness);
        $("#follow").attr('id', 'unfollow');
    }
    $.ajax({
        type: "POST",
        url: GLOBAL_BASE_PATH + "/payment/ajaxFollow/",
        data: 'businessID=' + businessID,
        success: function (data) {
            if (arg == 'follow') {
                var showmsg = msgFollowSuccess;
            } else {
                var showmsg = msgUnfollowSuccess;
            }
            jNotifyShow(showmsg, 'common_message', 'message_info');
        }
    });
}