Likely you got the problem solved already but since I had similar need, I'll reply here for others. The problem is that you are taking the wrong url from static html (probably looked different in the older versions) and you are basically sending "/page#" as an XHR (Firebug is your friend when it just doesn't work...). Instead, you can use the LinkFactory to create the link in your class, make a new function with parameters from your Javascript and then add only a relevant part of Javascript on the page (and at the same time, get rid of the actionlink on the page and just use the generated url directly in Javascript to make it less of a hack). I thought this wiki page http://wiki.apache.org/tapestry/Tapestry5AndJavaScriptExplained was well written and demonstrated best practices for dealing with Javascript.
Kalle On Sat, Dec 6, 2008 at 11:59 AM, mad7777 <m...@runbox.com> wrote: > > Hi! > > Still finding little problems upgrading from 5.0.11 to 5.0.17. Here is my > latest issue: > > I was using prototype's Ajax.PeriodicalUpdater to do polling by refreshing > a > zone. My code goes like this: > > component tml: > > <t:actionlink t:id="pollLink" zone="pollResults">Poll</t:actionlink> > <t:zone t:id="pollResults"/> > <t:block id="pollResultsBlock"> ${gameId} </t:block> > > component java: > > @Inject > private Block pollResultsBlock; > > @OnEvent(component = "pollLink") > Block poll() { > return pollResultsBlock; > } > > public int getGameId() { > return this.gameId; > } > > I inject this javascript: > > var url = $("pollLink").href; > var updater = new Ajax.PeriodicalUpdater('pollResults', url, { > asynchronous:true, > frequency:2, > evalJS:true, > onLoaded: function(transport) { > $("pollResults").style.display = "none"; > var result = $("pollResults").innerHTML; > eval("gameId = " + result + "['content']"); > // do some stuff with gameId > } > }); > > > All this used to word in 5.0.11, but in 5.0.17, although the ActionLink > works if I click it manually, the PeriodicUpdate now fails. Instead of > putting gameId in the block, I get the entire contents of the page. In > fact, the poll() method is never even invoked unless I click the link > manually. > > Moreover, I'd like to know if there is some right way to do polling via > Ajax. Notwithstanding the fact that it no longer works, my method seems > like a horrible hack... > > Thanks again, > Marc > > -- > View this message in context: > http://www.nabble.com/Ajax-polling-using-zone-tp20873920p20873920.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 > >