0

I have a simple question,

my jquery-ui-map function is here like this.

$('#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);
                  });
              });
          });
      });

It calls a web method called GetCoordinates() method.

my web method something like this,

[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" } ]}";

}

but it return nothing.how can I tell that crn object is a json,and get the coordinate.thank you all.I also tryed return string but failed get the cordinates.

sakir
  • 3,391
  • 8
  • 34
  • 50

0 Answers0