views:

118

answers:

2

Hi,

I'm trying to poll a script every few seconds. The script will return a timestamp, and if this timestamp is different from the previous (the first time is always true since it's comparing with nothing), then do something.

Thing is PeriodicalUpdater seems to work fine for me. But I read that JSON.parse does not work in IE<8. I'm therefore hoping there's another alternative that would support more browsers out there? Is there another plugin that can do ajax polling?

Thanks!

A: 

The best option is probably to just include json2.js or a similar JSON parser, that will implement JSON.parse in browsers that do not support it natively:

http://www.json.org/json2.js

Remember to always copy it to your own site, do not include it directly.

Jakob Kruse
do i need to do anything for PeriodicalUpdater to work fine in IE<8? Or do I just need to include that before calling the script? How will browsers that support JSON.parse natively react? Will they ignore the script? Thanks :)
Lyon
PeriodicalUpdater should work fine. Including json2.js does nothing in browsers that support JSON.parse natively.
Jakob Kruse
A: 

I found this and it fulfills all my needs. Seems to run lighter too :) http://github.com/tra/periodic

Lyon