RobertFischer / JQuery-PeriodicalUpdater

A port of Prototype's PeriodicalUpdater to JQuery
282 stars 50 forks source link

Updating data / settings between calls #13

Closed ryantology closed 13 years ago

ryantology commented 13 years ago

I can't seem to update the data passed into the ajax call between calls. I wanted to pass in an ID/date of the last result to help limit the results in the calls. It looks like the extend() method copies the variables rather than preserve their reference. Is there a way to update any of the setting / parameters after the init?

RobertFischer commented 13 years ago

That's really tricky to do because of the timing issues. That's why there is a copy made instead of passing the object by reference. This is one of those things that you think you want, but you really, really don't.

(If you really, really do, then feel free to fork the library and remove the copying code and have at. But I'm not taking any responsibility for maintaining that version of the code.)

To address your use case: you could try setting a handler in the "beforeSend" parameter. I think you could also provide an anonymous function as the value of a key attached to the "data" parameter, and it will get executed each time (should return a string).