Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/375.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用Json数组设置多段线路径_C#_Javascript_Asp.net_Ajax_Google Maps - Fatal编程技术网

C# 使用Json数组设置多段线路径

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

我已经创建了一个方法,它使用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 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数组吗???