Apache Wicket > Framework Documentation > Reference library > How to do things in Wicket > AJAX > Passing HTTP parameters to Ajax callback methods
Added by Will Hoover, last edited by Will Hoover on Apr 13, 2008

Passing HTTP Parameters To Ajax Callback Methods

The following example demonstrates capturing the window position and adding a URL parameter to the Ajax request (assumes "window.pos" exists):

webPage.add(new AbstractAjaxTimerBehavior(duration) {
		private static final long serialVersionUID = 1L;

		/**
		 * {@inheritDoc}
		 */
		@Override
		public final CharSequence getCallbackUrl(final boolean onlyTargetActivePage) {
			return super.getCallbackUrl(onlyTargetActivePage)) + "&pos=window.pos";
		}

		/**
		 * {@inheritDoc}
		 */
		@Override
		protected final void onTimer(final AjaxRequestTarget target) {
			final String pos = getRequest().getParameter("pos");
			// process pos ...
		}
	});