簡単な質問がありますが、
私の jquery-ui-map 関数はこのようにここにあります。
$('#map_canvas').gmap().bind('init', function () {
// This URL won't work on your localhost, so you need to change it
// see http://en.wikipedia.org/wiki/Same_origin_policy
$.getJSON('Ofislerimiz.aspx/GetCoordinates', function (data) {
$.each(data.markers, function (i, marker) {
$('#map_canvas').gmap('addMarker', {
'position': new google.maps.LatLng(marker.latitude, marker.longitude),
'bounds': true
}).click(function () {
$('#map_canvas').gmap('openInfoWindow', { 'content': marker.content }, this);
});
});
});
});
GetCoordinates() メソッドと呼ばれる Web メソッドを呼び出します。
私のWebメソッドはこのようなものです、
[WebMethod,ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = true)]
public static List<Kordinat> GetCoordinates()
{
var crn = ofs_bll.OfisKordinatGetir();
return crn;
// return "{"markers":[ { "latitude":57.7973333, "longitude":12.0502107, "title":"Angered", "content":"Representing :)" }, { "latitude":57.6969943, "longitude":11.9865, "title":"Gothenburg", "content":"Swedens second largest city" } ]}";
}
しかし、それは何も返しません.crnオブジェクトがjsonであることをどのように伝え、座標を取得できますか.ありがとうございました.文字列を返そうとしましたが、座標を取得できませんでした.