I am trying to get the locations of devices per project. I have a page which shows a google map and a list of all devices that belong to a project. My actions are:
public ActionResult GoogleMaps(int id)
{
return View(Project.Find(id).DeviceLocations);
}
public ActionResult Map(int id)
{
var map = Project.Find(id).DeviceLocations;
Locations l = new Locations();
l.locations = map;
return Json(l, JsonRequestBehavior.AllowGet);
}
The Jquery to get the Json:
jQuery().ready(function () {
$.getJSON("/Project/Map/68", loadMap);
});
Listing the devices that belong to a project works like this, but the json obviously fails because the id is null. In the jquery where you see 68, it should be the id of the project that is being viewed.
How can I achieve this?