I was going to write a simple vc messenger. Immediately there were problems with the appeal to api. I was searching for a couple of days, so far none of the examples found came up. Here is the code of a simple function that was supposed to return an object with an array of friends. 
I get an error in the console:
Please help with this problem. Preferably with a working example.
|
1 answer
Note the first example (“Cross Domain Request Using JSONP”):
var script = document.createElement('SCRIPT'); script.src = "https://api.vk.com/method/users.get?user_ids=210700286&fields=bdate&v=5.59&callback=callbackFunc"; document.getElementsByTagName("head")[0].appendChild(script); function callbackFunc(result) { alert(result.response[0].first_name) } Many popular libraries or frameworks (say, JQuery or Mithril) can work with JSONP (creating a temporary callback function and <script> ) automatically.
|
messages, then it will still not work onjs, since This method only works for standalone applications ..... well, even through the browser extension - Alexey Shimansky