I'm trying to send objects from a Java Listener (not the Javascript eventListener!) to a Javascript application without success.
The requirement is: a Javascript application running in the browser should ask to a Listener an object (such as an array) at the launch and the Listener responses giving the array. There are many ways to do this. What are the most relatively secure and efficient ones?
I will try now to do an example. The Javascript function asks thorough jQuery the array directly a JSON file (by HTTP GET request) and storing in this way its content in the 'data' variable, as follows:
$.get("./myJSONfile.json", function( data ){
// Stuff to do
var myArray = data;
...
}
and this without asking the intervention of any Servlet or Listener. What I have to do I want to use a Listener to pass the content of the JSON file to the Javascript function?