C# 使用Json数组设置多段线路径
我已经创建了一个方法,它使用c#从数据库返回纬度和经度数组,现在我想把这个列表传递给JavaScript,以绑定googlemaps上的poly#u线路径C# 使用Json数组设置多段线路径,c#,javascript,asp.net,ajax,google-maps,C#,Javascript,Asp.net,Ajax,Google Maps,我已经创建了一个方法,它使用c#从数据库返回纬度和经度数组,现在我想把这个列表传递给JavaScript,以绑定googlemaps上的poly#u线路径 var多选项={ var polyOptions = { strokeColor: '#000000', strokeOpacity: 1.0, strokeWeight: 3 } poly = new google.maps.Polyline(polyOptions); poly.setMap(map); var
var多选项={
var polyOptions = {
strokeColor: '#000000',
strokeOpacity: 1.0,
strokeWeight: 3
}
poly = new google.maps.Polyline(polyOptions);
poly.setMap(map);
var path = new MVCArray;
$.getJSON('json.cs', function(data) {
//var items = [];
$.each(data, function(key, val) {
path.push(new google.maps.LatLng(val.lat, val.longi));
});
// now update your polyline to use this path
poly.setPath(path);
});
<body onload="initialize()">
<div id="map_canvas" style="width:90%; height:100%"></div>
</body>
</html>
strokeColor:“#000000”,
笔划不透明度:1.0,
冲程重量:3
}
poly=新的google.maps.Polyline(多选项);
poly.setMap(map);
var路径=新的MVCArray;
$.getJSON('json.cs',函数(数据){
//var项目=[];
$。每个(数据、函数(键、值){
push(新的google.maps.LatLng(val.lat,val.longi));
});
//现在更新多段线以使用此路径
poly.setPath(path);
});
您能指定我如何用c语言编写代码来获取json数组吗???