I'm just trying to call a Javascript function from Java using JSObject. I need the Javascript function to update an HTML text field. For this I need to know the element ID and the value.
I have tried this but it doesn't work. When trying to access from Javascript the values passed are empty.
So my question is how can I access those values from Javascript? I must be missing something.
If I declare objects of size 1 it will work, but I need to pass 2 values in objects array.
Thanks in advance.
//Java code
Object[] objects = new Object[2];
objects[0] = "elementId";
objects[1] = "elementValue";
window.call("updateElement",objects);
//Javascript code
function updateElement(array){
alert(array[0]);
alert(array[1]);
}