send a  new parameter like a this....

var pars = 'tiempo=' + this.lastCheck + '&nocache= ' + cacheBuster()

function cacheBuster() {

  var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
  var randomstring = '';
       
  for (var i=0; i<20; i++) {
         var rnum = Math.floor(Math.random() * chars.length);
          randomstring += chars.substring(rnum,rnum+1);
  }           
  return randomstring + new Date().getTime();   
}

Daniel Herrero escreveu:
Hello,
My problem is the following: I have an Ajax.PeriodicalUpdater which sends several params to a php page and one of those is the actual date (tiempo) but I don´t know how to make it change in each request, the problem seens to be that once the parameters are defined, they don´t change any more.
Anybody knows how to resolve this? Thank you!!

the funtion is the following:

usuariosActivos : function() {
        var url = "" + 'controlUsuarios.php';
        var pars = 'tiempo=' + this.lastCheck
        var options = {method: 'post', parameters: pars,
                        onSuccess: (function(e) {alert(e.responseText);
                                           alert(this.lastCheck);
                                           var date = new Date();
                                           this.lastCheck = date.getTime();
                                      }).bind(this),
                        onFailure: (function(e){}).bind(this)}
        var object = {success:null, failure:null};
        this.myAjax = new Ajax.PeriodicalUpdater(object, url, options)
    },

--
Daniel Herrero Dávila

_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs


_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to