I am having a few challenges with the AjaxChannel queuing up and interfering with actions a user is making while in ajax requests are in queue. When my AbstractDefaultAjaxBehavior hits its respond method, it adds a JavaScript call to the target. Does that JavaScript get executed before the next ajax request is release from the AjaxChannel queue?

In my example below, the user would be clicking the button fast enough to queue the AjaxChannel. I need to know if the finishButtonWork function call would happen before or after the AjaxChannel releases the next ajax request from queue.

// HTML
<input type="button" onclick="callbackForBehvaior();"></input>

// JavaScript
callbackForBehavior = function() {
  Wicket.Ajax.ajax({blah});
}
getButtonDetails = function() {
    ...
    return buttonDetailsJSON;
}
finishButtonWork = function(json) {

}

// Java AbstractDefaultAjaxBehavior
protected void updateAjaxAttributes(AjaxRequestAttributes attribs){
        super.updateAjaxAttributes(attribs);

// Call the function that sets up the parameters to pass back to the server. attribs.getDynamicExtraParameters().add("return getButtonDetails();");
}
protected void respond(AjaxRequestTarget target) {
    ...
    target.appendJavaScript("finishButtonWork(" + resultJSON + ");");
}

--
Jered Myers

Reply via email to