Cant´t get the return value of Js function

Hi,
I’m using AbstractJavaScriptComponent and the callFuntion(“function”) to execute the js.
I cant´t get the return value the function

Example:

this.exibirPassageiros = function(jsonStringCliques, distanciaMaxima) {

    ...
    
    return listaPassageiros;
}

I call the function using RPC
callFunction(“exibirPassageiros”, cliquesJson.toString(), distanciaMaxima.doubleValue());

How can i get the return value?

you can by calling a function from the server side in your js.

example server side register the function:

addFunction("getExibirPassageiros ", new JavaScriptFunction() {            
            @Override
            public void call(JsonArray arguments) {
                //retrieve listaPassageiros : index 0 of arguments
            }
        });

and then call it on js side:

this.exibirPassageiros = function(jsonStringCliques, distanciaMaxima) {

        ...
        
        //Execute the method in server side
        self.getExibirPassageiros(listaPassageiros)
    }

How can i pass the arguments to the function?

just pass it in javascript.

self.getExibirPassageiros(listaPassageiros) this will invoke your server method with the argument with the value of your listaPassageiros variable

in server side you just get it.
Assume it is a String :

and get it that way. If other type change it

addFunction("getExibirPassageiros ", new JavaScriptFunction() {            
            @Override
            public void call(JsonArray arguments) {
                String txtReturn = arguments.getString(0);
            }
        });

Thanks man, it works perfectly!!!