'How do I use SetInterval to update pins on a google map from a database?
I have a Google map set up and it pulls locations from a database. If I refresh the page it is on it displays all of the pins properly, but I would like it to update every 10 seconds so that new pins will show up as they are added. I have the following code, but it isn't pulling the data in. Any help would be appreciated.
function(){
var mapsvg = this;
setInterval(()=>{
mapsvg.database.find()
}, 10000);
}
https://stackoverflow.com/questions/ask#
Solution 1:[1]
Try this code :
function fetch(){
var mapsvg = this;
setInterval(()=>{
mapsvg.database.find()
}, 1000);
}
fetch();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Hritik Sharma |
