X
X
X-2015-09-11 12:37:50
JavaScript
X-, 2015-09-11 12:37:50

VK API | Javascript SDK + Execute method with multiple api calls + captcha - How to process?

Application type - iframe
using Javascript SDK for VK API
When executing the execute method with the code:

var a=[];
var obj={};
obj = API.audio.search({"q": "Ыsз", "auto_complete:1":1, "count":1});obj.search="Ыsз";a.push(obj);
obj = API.audio.search({"q": "77т", "auto_complete:1":1, "count":1});obj.search="77т";a.push(obj);
...
obj = API.audio.search({"q": "оyt", "auto_complete:1":1, "count":1});obj.search="оyt";a.push(obj);
return a;

sometimes a window appears with a suggestion to enter a captcha.
If this window is closed, then (else block) is executed in the code
VK.api("execute",{code:code},function(data) { 
  if (data.response) { 
    console.info("EXECUTE OK:",data);
  } else {
    console.error("EXECUTE ERROR:",data);
  }
});

And if you enter the correct captcha in this window, then the previous code is not executed, an error occurs somewhere above:
VM163:1 Uncaught SyntaxError: Unexpected token <
done @ apps.js?276:943
r.onreadystatechange @ common.js?1124_163:3049

TP Vkontakte answered as follows:
You receive the data necessary for processing the error. The processing scheme is described here: vk.com/dev/captcha_error
Question: How to correctly catch the capcha needed error in the Execute method?

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