-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Phani wrote:
I understand what you have written below is same as getting value using
$("counter").innerHTML

var myajax = new
Ajax.PeriodicalUpdater("counter","http://[...]&rndtext=0";, [...]

But, my question is how to increment it. I want to increment the value
in "counter" element by 1 every time this updater runs....

OK, I guess you mean "how to change rndtext's value after each update?"

Use "onSuccess" option to bind a function that will do that.
Here is an example:

function PeriodicUpdater() {
 var cnt = $('counter');
 cnt._updater = new Ajax.PeriodicalUpdater(
   cnt,
   'http://testserver/phanites.nsf/AJAXAgent',
   {
     frequency: 4,
     decay: 2,
     parameters: {
       OpenAgent: '',
       rndtext: parseInt(cnt.innerHTML) || 0
     },
     onFailure: function(xhr) { alert("Error"); },
     onSuccess: function () {
       this._updater.options.parameters.rndtext++;
     }.bind(cnt)
   }
 );
}

cheers
- --
Marius Feraru
-----BEGIN PGP SIGNATURE-----

iD8DBQFFkhgTtZHp/AYZiNkRAtmtAKCmla+KDbOlnDUaVmPYU/O+nQTu5ACeKYH+
H3ZTGnOToQo2d+6OnUYTI9I=
=+oiI
-----END PGP SIGNATURE-----

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to