The function below grabs a php page, then reloads it every 5 seconds. The only thing coming from that roomdata.php
page is a string with a color name (blue, yellow, etc.). I wanted to be able to use that name in the function modifyLight(color)
, but it's not letting me. I don't know why, but no matter what I tried, it's not treating the variable data as a string, even if I clarify it as one.
Any help is appreciated, thanks!
$(function(){
function loadData()
{
var data = load('roomdata.php');
modifyLight(data);
setTimeout(loadData, 5000); // makes it reload every 5 sec
}
loadData(); // start the process...
});