9db8f865b1d5f3e3978b37e7a3480cc4

The goal is to add the time to all ajax requests so that no browsers cache the request and response. this works. I just think it needs to be beautifed. this uses prototype.

Ajax.Responders.register({

  onCreate: function()
  {
    var request = arguments[0];
 
    if (!request.parameters)
    {
      request.parameters = {};
    }
 
    if (!request.parameters.ms)
    {
      request.parameters.ms = new Date().getTime();
    }
  }

});

Refactorings

No refactoring yet !

A8d3f35baafdaea851914b17dae9e1fc

Adam

August 13, 2009, August 13, 2009 15:20, permalink

1 rating. Login to rate!
Ajax.Responders.register({
    onCreate: function(response) {
        response.parameters.ms = response.parameters.ms || new Date().getTime();
    }
});
9db8f865b1d5f3e3978b37e7a3480cc4

mikenereson.blogspot.com

August 16, 2009, August 16, 2009 16:46, permalink

No rating. Login to rate!

Perfect, Adam. Thanks.

Your refactoring





Format Copy from initial code

or Cancel