Note that there are some explanatory texts on larger screens.

plurals
  1. POMark multiple locations in Google Maps
    primarykey
    data
    text
    <p>I am trying to mark several locations on maps which I am fetching from Database through a php code :</p> <p><strong>PHP Code:</strong></p> <pre><code>&lt;?php error_reporting(0); $con = mysql_connect('localhost','root',''); $db = mysql_select_db('easydoes'); $query = mysql_query('SELECT city,latitude,longitude FROM zip_codes LIMIT 0 , 30'); while($row = mysql_fetch_assoc($query)) { $val[]=$row; } echo json_encode($val); ?&gt; </code></pre> <p><strong>HTML Code</strong></p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta name="viewport" content="initial-scale=1.0, user-scalable=no"&gt; &lt;meta charset="utf-8"&gt; &lt;title&gt;Simple markers&lt;/title&gt; &lt;style&gt; html, body, #map-canvas { height: 100%; margin: 0px; padding: 0px } &lt;/style&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt; &lt;/script&gt; &lt;script&gt; var obj; $(document).ready(function(){ $.post("markers.php",{},function(data){ obj=JSON.parse(data); //alert(obj[0].city); initialize(obj); }); }); &lt;/script&gt; &lt;script src="https://maps.googleapis.com/maps/api/js?v=3.exp&amp;sensor=false"&gt;&lt;/script&gt; &lt;script src="http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclusterer/1.0/src/markerclusterer.js"&gt; &lt;/script&gt; &lt;script&gt; function initialize() { var markers = []; for(var i=0;i&lt;obj.length;i++) { var myLatlng = new google.maps.LatLng( obj[i].latitude, obj[i].longitude); var mapOptions = { zoom: 4, center: myLatlng } var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); var marker = new google.maps.Marker({ position: myLatlng, map: map, title: obj[i].city }); markers.push(marker); } markerClusterer = new MarkerClusterer(map, markers, { maxZoom: 12, gridSize: 40, styles: "Default" }); } google.maps.event.addDomListener(window, 'load', initialize); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="map-canvas"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Where am I going wrong ? I am pretty new to Jquery and Java Script .</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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