In my Java Script page, I have a function that calls Wicket Ajax:
function callWicketPage() {
wicketAjaxGet(
urlCallback,
function() {alert('success'); },
function() { alert('failed');
});
}
And in the Wicket page, I have the following code:
final AbstractDefaultAjaxBehavior behave = new AbstractDefaultAjaxBehavior() {
@Override
public void renderHead(IHeaderResponse ihr) {
super.renderHead(ihr);
ihr.renderJavascript("var urlCallback = '" + this.getCallbackUrl() + "';", "insertedjavascript");
}
protected void respond(final AjaxRequestTarget target) {
}
};
add(behave);
I am looking to send a JSON response from the Wicket page to JavaScript. How can I achieve this?