我正在尝试获取每个项目的设备位置。我有一个显示谷歌地图的页面和属于一个项目的所有设备的列表。我的行为是:ASP MVC变量为JavaScript?
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);
}
jQuery的获得JSON:
jQuery().ready(function() {
$.getJSON("/Project/Map/68", loadMap);
});
清单属于一个项目中的设备是这样的,但因为id为null json的明显失败。在你看到的jquery中,它应该是正在查看的项目的id。
我该如何做到这一点?
这样做时出现以下错误:非激活成员。任何想法为什么? – Prd 2010-09-22 15:18:52
没关系,谢谢。 – Prd 2010-09-23 09:12:50