Yeah, it's easy! Thanks! Well, there is some things i wanna know...
1 - I figured it out that i don't need to write JSON as response for the even handling... Just returning the Zone's Body to magically refresh it is all i need (since the Grid knows how to build itself). But this code isn't working (sorry for the portuguese code, but i believe it's readable): @InjectComponent private Zone zoneMapa; @Log @CommitAfter public Block onGravarPoi(String nomePoi, String telefonePoi, String posXPoi, String posYPoi) { // code return zoneMapa.getBody(); } The ajax call looks like this (using jquery): $j.ajax({url: urlGravarPoi}); Do I need to change something? 2 - I did something like this to get the XHR URI in the JS: **** Page class **** @Inject private ComponentResources componentResources; public String getUrlGravarPoiXHR() { return componentResources.createEventLink("gravarPoi").toAbsoluteURI(); } **** Page template **** <t:hidden t:id="urlGravarPoi" value="prop:urlGravarPoiXHR" /> **** Map's JS event handling **** var urlGravarPoi = $j("input[name=urlGravarPoi]").val(); // and some workaround to append the context $j.ajax({url: urlGravarPoi}); Well, I just wanted to see it working and obviously that part isn't nice... Now, what's the best way for that? I didn't understand how the Autocomplete's mixin (the example from the tap site) uses the RenderSupport to pass the link to the js. Thanks for the reply! Any more help would be appreciated :) _______________________ Everton Agner Ramos 2010/9/10 Thiago H. de Paula Figueiredo <thiag...@gmail.com> > On Fri, 10 Sep 2010 08:47:03 -0300, Everton Agner <ton.ag...@gmail.com> > wrote: > > Hi! >> > > Hi, Everton! > > > - How can I make an Ajax call to some method on the Page? Is there any >> component that could act like a bridge for it? And I need to write JSON as >> response, and I don't wanna create a Servlet just for that purpose. >> > > See http://tapestry.apache.org/tapestry5.1/guide/ajax.html, section "Your > own AJAX components". > It's easy: > > * Define an event name > * Create an event handler method that handles this event and returns > JSONObject or JSONArray > * Inject ComponentResources > * Make your JavaScript request the URL created by > ComponentResources.createEventLink(). > > -- > Thiago H. de Paula Figueiredo > Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, > and instructor > Owner, Ars Machina Tecnologia da Informação Ltda. > http://www.arsmachina.com.br > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >