For example in your panel:
response-object gets passed.
TODO: add an example of Java code.
If you add any class that extends AbstractDefaultAjaxBehavior to your page, wicket-ajax.js will be added to the header ofyour web page. wicket-ajax.js provides you with two basic methods to call your component:
function wicketAjaxGet(url, successHandler, failureHandler, precondition, channel)
function wicketAjaxPost(url, body, successHandler, failureHandler, precondition, channel)
Don't POST without POST content
Note that some web servers gulp on HTTP POST requests with no POST content (in other words: "wicketAjaxPost($URL);" is evil).
This is due to some browsers (Firefox, ...) not sending the mandatory header "content-length" when the POST body is empty.
Jetty is generous in this case, while Tomcat might respond with an HTTP 411 error code.
Example - Wicket 6.0+
This snippet is taken from a piece of code that makes use of PackageTextTemplate, which is added in the renderHead( component, response ) of AbstractDefaultAjaxBehavior
Example - Older Versions
'$url$' is obtained from the method
You can optionally add arguments by appending these to the URL string. They take the form
Obtaining the GET/POST arguments on the server side
Ok, this is actually quite ugly, but you get the optional arguments in the response method like this:
Or to retrieve a single parameter by its key: