You'll like this in 5.4 better; the page initialization JSON is buried in a new key and handled automatically for you; it can now piggyback on any JSON Object response, not just the standard partial page render response.
On Mon, Nov 5, 2012 at 5:09 AM, Charlouze <m...@charlouze.com> wrote: > Can you send the client code that handle the request ? IMHO, I think that > you forget to process json response, I have already done that mistake a lot > of time. > > 2012/11/5 nquirynen <nat...@pensionarchitects.be> > > > Hi, > > > > I have a problem with executing some javascript after an ajax call to a > > tapestry event. > > > > *Test.class* > > public class Test { > > > > @Inject > > private ComponentResources componentResources; > > > > @Inject > > private AjaxResponseRenderer ajaxResponseRenderer; > > > > @Inject > > private JavaScriptSupport javaScriptSupport; > > > > public String getEventLink() { > > return > componentResources.createEventLink("alert").toURI(); > > } > > > > @BeginRender > > void beginRender() { > > javaScriptSupport.addScript("$.get('%s');", > > getEventLink()); > > } > > > > void onAlert() { > > ajaxResponseRenderer.addCallback(new > JavaScriptCallback() { > > > > @Override > > public void run(JavaScriptSupport > > javascriptSupport) { > > > > javascriptSupport.addScript("window.alert('test');"); > > } > > }); > > } > > } > > > > So following steps take place: > > > > 1) in beginRender() I add a ajax call to the event with JavascriptSupport > > 2) onAlert() is called and here I try to add a javascript callback with > > AjaxResponseRenderer > > > > in the response of the request I see the following: > > > > { > > "inits" : [ > > { > > "evalScript" : [ > > "window.alert('test');" > > ] > > } > > ] > > } > > > > But this javascript never fires. > > > > > > I don't understand why, I'm probably missing something here, so any input > > would be helpful. > > > > ps: I know the code doesn't make sense, it's just a simple example to > show > > where I'm stuck > > > > Nathan > > > > > > > > > > > > > > -- > > View this message in context: > > > http://tapestry.1045711.n5.nabble.com/ajaxResponseRenderer-in-event-tp5717654.html > > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > > For additional commands, e-mail: users-h...@tapestry.apache.org > > > > > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com