Why not pass your javascript an event link? Then your js can invoke getJSON, tapestry will handle the request and call an event handler server-side. Your event handler can then store the value and return a JSONObject. You can stick the value into the url as a request parameter and get it back out by injecting the Request object into your page/component/mixin. Better yet, if you're using T5.2.4, you can map the request parameter directly to an event handler via the @RequestParameter annotation.
Robert On Dec 8, 2010, at 12/84:55 PM , Tim Koop wrote: > I have a pile of Javascript on my page (it's a component really), and > sometimes it comes up with a value it needs to store on the server (in a > SessionState or something). Can someone please tell me the best way to call > the server from plain Javascript? > > I'm using jQuery, which is already working, so I suspect I would like to use > the jQuery.getJSON() or something similar, which I have done in other > non-Tapestry projects. > > The only way I can think of doing it now is to create a new page (with .tml > file and .java file), which produces JSON instead of html. > > Does anyone have any better ideas? > > I've looked into Mixins, but I don't know if that would apply. I just want > the Javascript code that calls the correct URL. > > Thanks. > > -- > Tim Koop > t...@timkoop.com <mailto:t...@timkoop.com> > www.timkoop.com <http://www.timkoop.com> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org