0

I have some javascript code that needs to call a method in an applet. The applet and the javascript are running in the same webpage. I know how to call applet methods from javascript and vice versa (e.g., using MyAppletID.appletMethodName(args) and JSObject, respectively), but both of these techniques only allow one-way communication. They don't permit return values to be passed from one language back to the other.

I'd like to be able to do something like this...

var result = 0;
callAppletMethod( JSON.stringify(args), function(r) { result = r; } )

... to call an applet method and store the return value in result.

Can anyone suggest a technique, library or toolkit that implements this sort of two-way Javascript-Applet communication?

Should I consider using a remote procedure call protocol like JSON-RPC? Or is there a better approach?

(I'm new to javascript and web programming.)

1 Answer 1

2
var result = MyAppletID.appletMethodName(args)

... should work fine to get a result from Java out to JavaScript.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.