M
M
Mikhail Mikhail2015-08-31 12:33:38
JavaScript
Mikhail Mikhail, 2015-08-31 12:33:38

What is my mistake when writing the script?

good afternoon. I study here API vk. and I can't figure out one problem. For some reason I can't upload to my wall. tell me how to do it right?

function authInfo(response) {
        if (response.session) {  //если польз авторизован
            VK.Api.call('photos.getWallUploadServer',  //получаем url на загрузку изображения для тестовой группы
                {
                    group_id: 60789482,  
                    v: 5.37
                },
                function (r) {     //отправляем картинку на выданный урл
                    $.ajax({
                        type: "POST",
                        url: r.upload_url,
                        photo: dataArray[index],
                        success: function (data) {
                            VK.Api.call('photos.saveWallPhoto',     //отправляем картинку на стену
                                {
                                    group_id: 96630252,
                                    photo: data.photo,
                                    server: data.server,
                                    hash: data.hash
                                }, function (r) {
                                    
                                    ArrayDataPicture += r;

                                });
                        }
                    });
                }
            );
        }
    }

    VK.Auth.getLoginStatus(authInfo);
    VK.UI.button('login_button')
</script>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question