how to get the value returned from callback funct

Get help using Construct 2

Post » Fri Jun 21, 2013 4:13 pm

I am using the Browser.ExecJS to get a value returned from callback but it doesn't seem to return , seems like i have to use this http://stackoverflow.com/questions/6847697/how-to-return-value-from-callback-function so based on the above, i have written like this,

function getWords(fn) {
             
              theCall = Bridge.query('words', {n: 5});
              var results;
       
             theCall.done(function (response) {
              results = JSON.stringify(response, null, 2);
             fn(results);
            });
};

and from the C2 event i call and i am assigning to a global text variable,
            
             Browser.ExecJS("getWords(function(result){
                        alert('getResults:'+result);
                      return result;
                 });")

Basically i needed a trick to read the values from C2 eventsheet returned from a javascript callback. Any help is appreciated ?
B
16
S
4
Posts: 248
Reputation: 2,267

Return to How do I....?

Who is online

Users browsing this forum: Congrats2u, jhjconstruct, tarek2 and 6 guests