How To Get Return Value To Eclipse Function From Java Script Function Which Get Data From Ajax Request Using Swt Browser?
I have tried below.... I have this in eclipse : I have a button in java which triggers this function in javascript Object status = browserCtrl.evaluate('return atm.java.webToJ
Solution 1:
When dealing with Ajax calls, you'll have to call a so-called BrowserFuntion
from your Javascript code when you have the result.
Here's an example of how to define a BrowserFunction
and how to call it from Javascript:
publicstaticvoidmain(String[] args)
{
finalDisplaydisplay=newDisplay();
finalShellshell=newShell(display);
shell.setLayout(newFillLayout());
Browserbrowser=newBrowser(shell, SWT.NONE);
browser.setText("<a href='#' onClick='theJavaFunction()'>Click me!</a>");
newBrowserFunction(browser, "theJavaFunction")
{
@Overridepublic Object function(Object[] objects)
{
System.out.println("Call from Javascript");
returnnull;
}
};
shell.pack();
shell.open();
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
{
display.sleep();
}
}
}
Furthermore, an excellent tutorial about Browser
from Vogella here:
Post a Comment for "How To Get Return Value To Eclipse Function From Java Script Function Which Get Data From Ajax Request Using Swt Browser?"