D
D
Dmitry2016-03-15 01:25:03
JavaScript
Dmitry, 2016-03-15 01:25:03

How to make a request to vk server using JSONP?

Wrote code that, as suggested here , should technically work. However, no message is displayed. Tried to check to enter instead of a variable in the argument a constant - "1". Still nothing came up. What could be the problem? Is the vk application configured incorrectly? Are query variables set incorrectly?

function addScript(src){
        var elem=document.createElement("script");
        elem.src=src;
        document.head.appendChild(elem);
    }
    function callbackFunc(vari){
        alert(vari.response[0]); // или alert(1);
    }
    addScript('https://oauth.vk.com/access_token?client_id=*******&client_secret=******&v=5.50&grant_type=client_credentials&callback=callbackFunc');

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
littleguga, 2016-03-15
@Papa_kfc

This will work if you control the server's responses. You need regular get/post requests.
Read this
upd: If you want to authorize a user on your site, you need to redirect
him to VK using a link with an authorization request.
give VK.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question