You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alec Swan <al...@gmail.com> on 2012/05/22 02:41:33 UTC

How to redirect to a page from an AJAX request?

Hello,

I use AjaxSubmitLink to submit a form that has captcha. I refresh
captcha by adding it to ajax request. However, when the user
successfully submits the form I want to redirect the user to a
different page. I tried setResponsePage and throw new
RestartResponseException in AjaxSubmitLink#onSubmit, but they seem to
have no effect.

How can I redirect the user to a page from an ajax request?

Thanks,

Alec

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


Re: How to redirect to a page from an AJAX request?

Posted by Alec Swan <al...@gmail.com>.
My apologies, setResponsePage does work from AJAX requests.

I had two problems - one with a missing JS reference which I detected
by looking at Wicket Ajax Debug and the other one with my Wicket test
class.

Thanks,

Alec

On Tue, May 22, 2012 at 12:08 AM, Alexander Cherednichenko
<le...@gmail.com> wrote:
> hi!
>
> you could check it with the Wicket Ajax Debug - for the ajax redirect it
> should receive and process javascript instruction which resets location of
> the page.
>
> maybe there are some JS errors out there?
> On May 22, 2012 8:59 AM, "Melinda Dweer" <me...@gmail.com> wrote:
>
>> IFAIK setResponsePage(Page.class) should work: at least I remember using it
>> successfully on an AJAX request cycle to redirect to a different page.
>>
>> Regards,
>>
>> Melinda
>>
>> On Tue, May 22, 2012 at 2:41 AM, Alec Swan <al...@gmail.com> wrote:
>>
>> > Hello,
>> >
>> > I use AjaxSubmitLink to submit a form that has captcha. I refresh
>> > captcha by adding it to ajax request. However, when the user
>> > successfully submits the form I want to redirect the user to a
>> > different page. I tried setResponsePage and throw new
>> > RestartResponseException in AjaxSubmitLink#onSubmit, but they seem to
>> > have no effect.
>> >
>> > How can I redirect the user to a page from an ajax request?
>> >
>> > Thanks,
>> >
>> > Alec
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>>

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


Re: How to redirect to a page from an AJAX request?

Posted by Alexander Cherednichenko <le...@gmail.com>.
hi!

you could check it with the Wicket Ajax Debug - for the ajax redirect it
should receive and process javascript instruction which resets location of
the page.

maybe there are some JS errors out there?
On May 22, 2012 8:59 AM, "Melinda Dweer" <me...@gmail.com> wrote:

> IFAIK setResponsePage(Page.class) should work: at least I remember using it
> successfully on an AJAX request cycle to redirect to a different page.
>
> Regards,
>
> Melinda
>
> On Tue, May 22, 2012 at 2:41 AM, Alec Swan <al...@gmail.com> wrote:
>
> > Hello,
> >
> > I use AjaxSubmitLink to submit a form that has captcha. I refresh
> > captcha by adding it to ajax request. However, when the user
> > successfully submits the form I want to redirect the user to a
> > different page. I tried setResponsePage and throw new
> > RestartResponseException in AjaxSubmitLink#onSubmit, but they seem to
> > have no effect.
> >
> > How can I redirect the user to a page from an ajax request?
> >
> > Thanks,
> >
> > Alec
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>

Re: How to redirect to a page from an AJAX request?

Posted by Melinda Dweer <me...@gmail.com>.
IFAIK setResponsePage(Page.class) should work: at least I remember using it
successfully on an AJAX request cycle to redirect to a different page.

Regards,

Melinda

On Tue, May 22, 2012 at 2:41 AM, Alec Swan <al...@gmail.com> wrote:

> Hello,
>
> I use AjaxSubmitLink to submit a form that has captcha. I refresh
> captcha by adding it to ajax request. However, when the user
> successfully submits the form I want to redirect the user to a
> different page. I tried setResponsePage and throw new
> RestartResponseException in AjaxSubmitLink#onSubmit, but they seem to
> have no effect.
>
> How can I redirect the user to a page from an ajax request?
>
> Thanks,
>
> Alec
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>