Shure you can always add a subclass of DefaultAjaxBehavior, get a callback url from this behavior and call this URL with wicket ajax later.
Somewhat like this: AbstractDefaultAjaxBehavior ajaxBehavior = new AbstractDefaultAjaxBehavior() { @Override public void respond(@NotNull AjaxRequestTarget target) { String myParam = RequestCycle.get().getRequest().getPostParameters().getParameterValue("my_param").toString(); // do stuff here, add something to target } }; component.add(ajaxBehavior); // in your component @Override public void renderHead(IHeaderResponse response) { super.renderHead(response); response.render(OnDomReadyHeaderItem.forScript("initMyStuff('"+ajaxBehavior.getCallbackUrl()+"');")); } // in JS function initMyStuff(yourCallbackUrl) { doThirdPartyStuff().then(function () { Wicket.Ajax.post({ u: yourCallbackUrl, ep: {"my_param": "something"}, fh: [function (attrs, jqXHR, errorMessage, textStatus) {/* handle failure here */ }], sh: [function (attrs, jqXHR, data, status) {/* handle success here */ }], }); }); } On Sat, 15 Feb 2020 at 13:04, Gabriel Landon <glan...@piti.pf> wrote: > Hi, > > In a form I have a form with an AjaxButton. > On the button's click I would like to be able to call an async third party > javascript function(recaptcha V3). > > Is there a way to call it and in the "then" function do the wicket's ajax > call. > Something like : > grecaptcha.execute('<publicCaptchaKey>', {<options>}).then(<do the wicket > ajax call >); > > I did not find a way to do it with IAjaxCallListener. > I'm using wicket 7. > > In wicket 1.5, I think that might have been possible like that: > protected IAjaxCallDecorator getAjaxCallDecorator() { > return new AjaxCallDecorator() { > @Override > public CharSequence decorateScript(Component c, CharSequence script) > { > return "grecaptcha.execute('publicCaptchaKey', {action: > 'action'}).then(function(token) { " > + <do_some_stuff> > + script <--- wicket ajax > + "}) "; > } > }; > } > > regards, > > Gabriel. > > -- > Sent from: > http://apache-wicket.1842946.n4.nabble.com/Users-forum-f1842947.html > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >