views:

17

answers:

0

I am using the following code to get data from database and output it as JSON:

public ActionResult Map()
    {
        var map = DeviceLocation.FindAll();
        Locations l = new Locations();
        l.locations = map;
        return Json(l, JsonRequestBehavior.AllowGet);
    }

Is there a way to make this ActionRsult auto refresh? The JSON that is being outputted are coordinates, and those coordinates are being updated continously in the database. I already got the google map fetching the json and updating the markers automatically every 30 seconds, but the JSON needs to be regenerated from the database aswell. Does anyone know how to do this?