0

I have a web application,in which I use Mustache.js templating library. I am loading a list of hospitals using a HospitalListTemplate as in the code$(this.el).html(Mustache.to_html(HospitalListTemplate, { 'data': this.model.toJSON(), 'longitude': lon, 'latitude': lat, 'isEdit': false })); after this I am calling a mapLoad() function function mapLoad(){ $(".gllpLatlonPicker").each(function () { (new GMapsLatLonPicker()).init($(this)); }); } which loads Google map using jquery-latitude-longitude-picker-gmaps my issue is the map is not being loaded in the template.Debugging in chrome console gives $(".gllpLatlonPicker") as [] i.e template is not available for the map to load,so map could not be loaded.Is there any way to load the template fully first and then call the mapLoad() function??

dany
  • 1,801
  • 7
  • 27
  • 40
  • are you initialize template and map in document.ready() function of jquery? – Miki Shah Dec 17 '12 at 12:17
  • No,template and map are not initialized on document.ready.Actually,a HTML skeleton is loaded and my template with map in it has to load on another event in to this skeleton. – dany Dec 18 '12 at 04:23

1 Answers1

0

If you are using the Places API to get a list of hospitals, the Places API results object will include lat, lon in the following format:

    "geometry" : {
     "location" : {
       "lat" : -33.8669710,
       "lng" : 151.1958750
     }

Where "place" is a hospital listing), you can either pass the place.geometry.location object, or call place.geometry.location.lat() and place.geometry.location.lng() to get the lat, lon values.

frabjousB
  • 104
  • 3