You can't really rely on Tapestry expansions inside JS code ... it's best to
use the RenderSupport to pass data to the Javascript. You may find this wiki
post helpful:
http://wiki.apache.org/tapestry/Tapestry5AndJavaScriptExplained

2009/10/12 Angelo Chen <angelochen...@yahoo.com.hk>

>
> Hi Toby,
>
> It got called in the firefox but not in safari, here is what I do:
>
> in the .tml file:
>  < script type="text/javascript">
>
>        function updateItem() {
>            return "${updateItem}";
>        }
>
>    </script>
> in the .js file:
>
> jQuery.post(updateItem(), { item_no : ino  }, function(data){
>      alert("Data Loaded: " + data.status), "json";
>    });
>
>
>
> Toby Hobson-3 wrote:
> >
> > Are you sure you're javascript is using the correct url? I don't know
> what
> > your updateItem() JS function does, but generally you need to construct
> > the
> > actionlink url (as you have done) then pass this to the javascript using
> > RenderSupport's addScript() method
> >
> > Toby
> >
> > 2009/10/12 Angelo Chen <angelochen...@yahoo.com.hk>
> >
> >>
> >> Hi,
> >>
> >> I'm trying to call an actionlink from a javascript, but i'm getting:
> >>
> >> Remote server closed the connection before sending response header
> >>
> >> and I never see the pop up dialog in the javascript,
> >>
> >> any idea how to avoid errors like this? Thanks.
> >>
> >> A.C.
> >>
> >> sample code:
> >>
> >> in java:
> >>
> >> public String getUpdateItem() {
> >>        return resources.createActionLink("updateItem", false).toURI()
> >> }
> >>
> >>
> >> Object onUpdateItem() {
> >>   return new TextStreamResponse("text/html", "ok");
> >> }
> >>
> >> in javascript:
> >>
> >> jQuery.post(updateItem(), { item_no : ino  }, function(data){
> >>   alert("Data Loaded: " + data);
> >>  });
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/t5%3A-calling-action-link-from-a-javascript-tp25849523p25849523.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
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/t5%3A-calling-action-link-from-a-javascript-tp25849523p25849812.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