I figured this out - the handler was being invoked by the JS component in two different places - one using Wicket.Ajax.get() and the other by direct jquery Ajax invocation (same callback URL). I swapped out the plain jQuery invocation for a Wicket.ajax call and everything works as expected.
N On Thu, Oct 31, 2013 at 5:28 PM, Nick Pratt <nbpr...@gmail.com> wrote: > The JS component sends JSON to the server and expects JSON in response. I > was stepping through the Wicket code, and it looks like I can only invoke > scheduleRequestHandlerAfterCurrent once since there is only a single 'next' > variable. Any JS appended to the ART doesn't seem to get executed on the > client when Im sending the JSON response back. ill keep digging. > > > On Thu, Oct 31, 2013 at 4:35 PM, Ernesto Reinaldo Barreiro < > reier...@gmail.com> wrote: > >> Hi, >> >> Yes I think than when you schedule new request target ajax request target >> is discarded. >> >> I do not know how this component works but maybe you can return your JSON >> as part as a javaScript eval >> >> target.append("myEvalaJSON('JSON')) >> >> ? >> >> >> On Thu, Oct 31, 2013 at 8:35 PM, Nick Pratt <nbpr...@gmail.com> wrote: >> >> > Wicket 6.11 >> > >> > I have an AbstractDefaultAjaxBehavior that returns JSON in its protected >> > void respond( AjaxRequestTarget target ) method by: >> > >> > requestCycle.scheduleRequestHandlerAfterCurrent( new TextRequestHandler( >> > "text/plain", "UTF-8", json ) ); >> > >> > This ADAB is used for returning status information back to a client side >> > Javascript component (FileUploader), and the interoperation of the >> > Javascript component and Wicket via JSON works. >> > >> > However, it seems that simple javascript appended to the ART is not >> being >> > invoked on the client. Is the scheduleRequestHandlerAfterCurrent() >> above >> > replacing the Ajax response that would normally have been sent back to >> the >> > client (in this case the Ajax updates - components and javascripts >> added to >> > the ART)? >> >> >> > >> Is there way to return JSON, and also have the ART updates triggered? I'm >> > not seeing anything in the AjaxDebugger on the client, so it looks like >> my >> > simple test alert('here'); is not being sent or interpreted correctly by >> > the client. >> > >> > N >> > >> >> >> >> -- >> Regards - Ernesto Reinaldo Barreiro >> > >