I have the following weird problem. I have an HTML page that has some RGraph gauges, which I want to update at regular intervals using Ajax.
The relevant code looks like this:
var update = function(){
$.ajax({
url : "update.php",
dataType : 'json',
success : function (json) {
meterWind.set('value',json['hum']);
}
});
};
$('#test').click(function(){
update();
});
setInterval(update, 2000);
The json output is ok, I checked it with an alert and it does return a value, for some reason the gauge was not updating. So to test it further I created a button "test" and set the function update() to trigger when test is clicked.
Now for some reason, when I click the test button, the gauge updates as it should - which suggests that the update() function works, just try clicking the test button several times.
However, no matter what I do and tried, when I trigger the function with the setInterval, the gauge does not change... weird, any suggestions?
http://meteotemplate.com/templateTest/testing/index.html
I also tried setting the interval on the "click" and when I put alert in the click, it alerts, but again, no update on the gauge.
var x = setInterval(function(){ $('#test').trigger("click");}, 3000);