D
D
Dmitry Sonko2012-05-21 15:46:46
In contact with
Dmitry Sonko, 2012-05-21 15:46:46

Question about VK Api and wall.post method?

The project was tasked with sending the posted comment to the VK wall in the form: “I left a comment there with such and such text.” I made the main functionality, we initiate, we check the authorization status, if we are not authorized, we log in, we call the wall.post method through and here I have a strong blunt.

VK.Api.call('wall.post', {
    message:text
}, function(r) {
    if(typeof r.response.post_id != 'undefined') {
        alert(r.response.post_id);
        return true;
    }
});
With this code, we create a frame with a request: “The waste application offers to post the following entry on your wall and in the news of your friends. ”, when you click on the “post” button, the entry is posted on the wall, we get a callback, we sambit the main form with the text and the comment flies to the site. The bad thing is that when you click on the “cancel” button for placing an entry, there is no callback, although for example, when using VK.Auth.login, there is a callback when you click on the cancel button.
VK.Auth.login(function(response) {
    if (response.session) {
        alert('login succesfull');
    } else {
        alert('cancel button pressed');
    }
}
How can I catch the window closing with a request to place an entry?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Seklth, 2012-05-25
@Seklth

  VK.api('wall.post',{message: 'test'}, function(data) {
                if (data.response) { // если получен ответ
                    alert('Сообщение отправлено! ID сообщения: ' + data.response.post_id);
                } else { // ошибка при отправке сообщения
                    alert('Ошибка! ' + data.error.error_code + ' ' + data.error.error_msg);
                }
  });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question