Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding multiple markers to Google Map
    text
    copied!<p>I'm looking to add markers for each business listed to a Google map v3 API <a href="http://www.inside-guides.co.uk/brentwood/shops-and-shopping/clothes-shops.html" rel="noreferrer">on this page</a> in the top right hand corner.</p> <p>I'm not sure how to do this for multiple postcodes, but the one we currently use on the <a href="http://www.inside-guides.co.uk/brentwood/shops-and-shopping/clothes-shops/lucys-boutique-557.html" rel="noreferrer">individual business pages</a> use a URLencode for the dynamic postcodes stored in the database.</p> <p>Here's the code we use for the individual pages:</p> <pre><code>&lt;script src="http://maps.googleapis.com/maps/api/js?q=London&amp;key=AIzaSyBaPEDyFbbnWjtvT8W3UBOM34Y7g6vK69A&amp;sensor=false"&gt;&lt;/script&gt; var map; function initialize() { var mapOptions = { zoom: 15, center: new google.maps.LatLng(51.511214,-0.119824), mapTypeId: google.maps.MapTypeId.ROADMAP }; var geolocate = function(address, callback) { $.ajax({ url: "http://maps.googleapis.com/maps/api/geocode/json", data: { "sensor": true, "address": address }, dataType: "json", success: function(d) { if (d.status == "ZERO_RESULTS") callback(false); if (d.results &amp;&amp; d.results[0] &amp;&amp; d.results[0].geometry) { callback({ "ne": d.results[0].geometry.bounds.northeast, "sw": d.results[0].geometry.bounds.southwest, "center": d.results[0].geometry.location }); } else callback(false); } }); }; map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); geolocate("&lt;%=server.URLEncode(""&amp;rsAdvert("ContactPostcode"))%&gt;", function(c) { map.setCenter(new google.maps.LatLng(c.center.lat, c.center.lng)); }); } google.maps.event.addDomListener(window, 'load', initialize); $('#myModal').on('shown', function () { google.maps.event.trigger(map, 'resize'); }) </code></pre> <p>The postcodes for that page are generated in ASP:</p> <pre><code> if rsDB_Ads("ContactPostcode") &lt;&gt; "" then strTempHTML = "[ContactPostcode]" strDB_AdvertItem = Replace(strDB_AdvertItem, "&lt;!--ContactPostcode--&gt;", strTempHTML) Else strDB_AdvertItem = Replace(strDB_AdvertItem, "&lt;!--ContactPostcode--&gt;", "") End if </code></pre> <p>Hoping someone can help..</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload