Javascript Google maps使用asp.net mvc从sql查询结果
我找不到任何关于如何使用DB查询(sql)并在地图上显示所有结果的方法,而我只有地址, 我有大约12000个结果,我只有街道名称和编号+城市名称, 我每次只能得到一个结果,我需要得到更多Javascript Google maps使用asp.net mvc从sql查询结果,javascript,asp.net-mvc,google-maps-api-3,Javascript,Asp.net Mvc,Google Maps Api 3,我找不到任何关于如何使用DB查询(sql)并在地图上显示所有结果的方法,而我只有地址, 我有大约12000个结果,我只有街道名称和编号+城市名称, 我每次只能得到一个结果,我需要得到更多 public async Task<ActionResult> Index() { var model = await db.synagogues.Take(5).ToListAsync(); return View(model.ToList()); } 你能展示你的javas
public async Task<ActionResult> Index()
{
var model = await db.synagogues.Take(5).ToListAsync();
return View(model.ToList());
}
你能展示你的javascript代码吗?你是如何得到结果的?你是如何调用
codemaddress
?
function codeAddress() {
var address = document.getElementById('address' + i).value;
geocoder.geocode({ 'address': address }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
});
}
google.maps.event.addDomListener(window, 'load', initialize);