Thank you Martin, we ended up doing the ajax call in a semi-manual way: we are still using PackageTextTemplate but this time we are only passing the AjaxRequestAttributes and declaring them as an object in js, that way we can add extra paremeters that are dynamically generated right from javascript.

Thanks again for the response.

On 02/07/14 00:55, Martin Grigorov wrote:
Hi,

Using #updateAjaxAttributes() is the recommended way.
You can add:
-  extra parameters - their values are know when the callback script is
being generated
- dynamic extra parameters - their values are dynamically calculated just
before the Ajax call is done

But as you may see at other places you can also use the JavaScript APIs to
make a call to the server ad-hoc. The main thing you should know/have it
the destination url.


Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov


On Tue, Jul 1, 2014 at 10:15 PM, Edgar Merino <donvo...@gmail.com> wrote:

Hello, we've been working on some javascript code that needs to compute
some values before sending the request to wicket server side. Currently, we
bind directly to the component's click event using jquery from js, and send
the request using Wicket.Ajax.post function. To pass the needed variables
to make the ajax call (e.g. callbackUrl) from java to js we are using
PackageTextTemplate.

Everything works fine, but then I saw lots of examples using
getCallbackScript, and they modify the AjaxRequestAttributes through the
AbstractDefaultAjaxBehavior#updateAjaxAttributes() method to pass extra
parameters that need to be sent with the request.

I believe both approaches would work, but updating the
AjaxRequestAttributes seems the best way to go... am I missing something
here?


Thanks in advance.
Edgar Merino.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to