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
>
>

Reply via email to