views:

40

answers:

2

I have a span element which display's a changing duration value.

<span id="vtime">--:--</span>

Unfortunately, due to the JS API i am using these is no way to pick up that value other than to listen to the changing text in the Span element.

I want to pick up the values and execute a javascript ajax command to fetch a value for the captions at certain time instances such as 11:30, 23:30...

What's the best way of doing this?

Environment: php

A: 

Why not put it in the code that's actually updating #vtime?

ceejayoz
for many reasons, can't.
esimran
Then your best bet is probably going to be listening to the contents of that value.
ceejayoz
lol thats what i'm asking.
esimran
A: 

if i understand the question correctly you can use setInterval() to run a js function , lets say every 5 , 10 secs .. it picks up the value from inside the span by maybe using document.getElementById('vtime').innerHTML , strip it if it has tags with it and compare to the time u want to run a specific fetch command at.

Sabeen Malik
that's what i have thinking... seems like that's the best way.Thanks
esimran