Jafari Sharib
Jafari Sharib

Reputation: 63

Wicket : How to refresh/redraw a wizard onSubmit?

I have a Wizard(org.apache.wicket.extensions.wizard.Wizard) that has an AjaxButton as its Next Button.

I am performing a long running operation on onSubmit() method of next button. Before exiting from the method I am using ajaxTarget.appendJavascript(js) where ajaxTarget is AjaxRequestTarget and js is a JavaScript snippet that I want to be evaluated.

Now, as far as I know, this script won't get executed until `onSubmit()´ has returned and the response is send back to the browser.

How can I execute my JavaScript immediately without waiting for onSubmit to have finished?

Note: I am using Wicket-4

Upvotes: 0

Views: 396

Answers (1)

svenmeier
svenmeier

Reputation: 5681

this script won't get executed until the wizard is redrawn/refreshed.

All appended JavaScript snippets are executed once the AjaxRequest has finished - the wizard itself does not need to be updated.

If you're executing a long running task from your Ajax request, the browser's Ajax request will eventually run into a timeout. You should move your long running task onto a separate thread.

Upvotes: 1

Related Questions