jquery - How to use Google Maps JavaScript API v3's Geocoding Service in Filter.js? -


i using filter.js in website along google maps api v3 shows in its demo/example(of filter.js) 1 difference, requirements use address instead of latitude or longitude , far know done using geocoding service of google maps. have modify of code:

before

addmarker: function(salon){     var = this;     var marker = new google.maps.marker({       position: new google.maps.latlng(salon.lat, salon.lng),       map: this.map,       title: salon.title     });      marker.info_window_content = salon.title + '<br/> treatments: ' + salon.treatments + '<br/> booking: ' + salon.bookings_1 + '<br/> address: ' + salon.address + '<br/><a href="' + salon.permalink + '"> view full details </a>'     this.markers[salon.id] = marker      google.maps.event.addlistener(marker, 'click', function() {       that.infowindow.setcontent(marker.info_window_content)       that.infowindow.open(that.map,marker);     });   }, 

after

addmarker: function(salon){     //new line address      var salonaddress = salon.address1 + ' ' + salon.address2 + ' ' + salon.address3 + ', ' + salon.city + ', ' + salon.state + ' ' + salon.postal_code + ', ' + salon.country ;     console.log(" salonaddress: " + salonaddress)     var = this;     geocoder.geocode( { 'address': salonaddress}, function(results, status) {         if (status == google.maps.geocoderstatus.ok) {           that.map.setcenter(results[0].geometry.location);           var marker = new google.maps.marker({               map: this.map,               title: salon.title,               position: results[0].geometry.location           });           marker.info_window_content = salon.title + '<br/> treatments: ' + salon.treatments + '<br/> booking: ' + salon.bookings_1 + '<br/> address: ' + salon.address + '<br/><a href="' + salon.   permalink + '"> view full details </a>'             that.markers[salon.id] = marker              google.maps.event.addlistener(marker, 'click', function() {               that.infowindow.setcontent(marker.info_window_content)               that.infowindow.open(that.map,marker);             });          } else {           alert('geocode not successful following reason: ' + status);         }     });    }, 

it looks working not showing markers on map @ all. trying find mistake after many hours still not fix it. can 1 point out coding mistake?

i have changed "this" "that" in following code , how fixed issue. not sure logic yet.

before:

var marker = new google.maps.marker({               map: this.map,               title: salon.title,               position: results[0].geometry.location           }); 

after:

 var marker = new google.maps.marker({               map: that.map,               title: salon.title,               position: results[0].geometry.location           }); 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -