I need to display currently stored data on website which refreshes itself automatically only if the data changed.
My current approach which failed:
- request data from database let's say every 10s
- check if this data differs from the currently displayed one
What I did:
setInterval(function() {refreshData()}, 5000);
function refreshData() {
@{
var db2 = Database.Open("StarterSite");
string tresc2 = db.QuerySingle(someQuery, 3).Tresc;
<text>
alert(@tresc2);
</text>
}
}
the problem here is that this code seems to be working fine, I do not get any error messages but @tresc2 does not exist. It looks like db2 also does not exist.
I do not understand what is going on here.
Two questions if I may:
- what should be a proper approach to my problem?
- what do I do wrong here?
Thank you
alertneeds quotes around the argument.