Hi. I'm trying to call a javascript function from a php page but I'm having problems passing the variables around, it seems like it's out of the scope of the function and I can't see why.
I'm trying to get the 'check_change' function to run every 5 seconds.
The Firefox error console says 'timestamp is not defined'.
I don't understand why the variable is not passing to the function. If I replace the code with this
It displays the variable just fine.
Any suggestions?
Thanks.
I'm trying to get the 'check_change' function to run every 5 seconds.
Code:
function check_change_timer(newspost, timestamp)
{
newspost = newspost;
timestamp = timestamp;
setInterval("check_change(newspost, timestamp);", 5000);
}
The Firefox error console says 'timestamp is not defined'.
I don't understand why the variable is not passing to the function. If I replace the code with this
Code:
function check_change_timer(newspost, timestamp)
{
newspost = newspost;
timestamp = timestamp;
alert(timestamp);
}
It displays the variable just fine.
Any suggestions?
Thanks.