You need to make a button on click of which user will join a group of VC, how to implement?

I tried to do this option.
$(".buttonVK").click(function(event){
event.preventDefault();
VK.init({
 apiId: 0000
 }); 
 function authInfo(response) {
 if (response.session) {
 console.log('user: '+response.session.mid);
 } else {
 console.log('not auth');
}
}
VK.Auth.login(authInfo);
VK.Auth.getLoginStatus(authInfo);
 VK.Api.call('groups.join', {group_id: 0000}, function(){});
});

Hang the button event on click, initialize the app and using method groups.join the user to join the group.
Please help to understand this issue, thank you!
September 18th 19 at 23:45
1 answer
September 18th 19 at 23:47
This method only for applications, not for websites. Place the widget on the public website, there a button the entry is, who should, he will click. There is a second method, black and for him to ban the site, and the public make the aforementioned invisible block and put it under the cursor button, or over the desired you click.

Find more questions by tags jQueryAPI