Return JavaScript value from a callback

Maddo7

Client
Регистрация
09.05.2015
Сообщения
123
Благодарностей
5
Баллы
18
I need to run some code on a website and once it finishes, I need to return the data from the callback:

JavaScript:
   doSomething().then(function(token) {

        return token;

       });
The problem is that the "Custom JavaScript code" block finishes before the result is ready and nothing gets returned to the variable.
How can I solve this?
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 480
Благодарностей
5 917
Баллы
113
I need to run some code on a website and once it finishes, I need to return the data from the callback:

JavaScript:
   doSomething().then(function(token) {

        return token;

       });
The problem is that the "Custom JavaScript code" block finishes before the result is ready and nothing gets returned to the variable.
How can I solve this?
You should add some waiting function to your code probably.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)