title: Populate map with data from SQL Database using Google Maps javascript API?
body: <p>What I'm trying to do is to populate routes using the Google Maps API. I've written a working function that takes in any given array of lat/long values, I have a big database coordinates and I want to populate the map with a selection.</p>
  
  <p>How can I get the data into JavaScript? So far I've got a button on the site and when pressed it runs a query that echoes what I need into some new page in JSON format: </p>
  
  <pre><code>$con = mysqli_connect("localhost","root","password","database");
  
  $return_arr = array(); $result = mysqli_query($con,"SELECT * FROM
  Flight_Data WHERE  `DepDateTimeUTC` LIKE  '%10/1/13%'");
  
  
  while ($row = mysqli_fetch_array($result)) {
      $row_array['ID'] = $row['ID'];
      $row_array['OriginLat'] = $row['OriginLat'];
      $row_array['OriginLong'] = $row['OriginLong'];
      $row_array['DestinLat'] = $row['DestinLat'];
      $row_array['DestinLong'] = $row['DestinLong'];
  
      array_push($return_arr,$row_array); }
  
  $jsonarray = json_encode($return_arr); echo $jsonarray;
  </code></pre>
  
  <p>This is a sample of the data:</p>
  
  <pre><code>[
      {
      "ID":"1",
      "OriginLat":"48.6899",
      "OriginLong":"9.2220",
      "DestinLat":"37.014425",
      "DestinLong":"-7.965910"
      },
      ....
  ]
  </code></pre>
  
  <p>So I need to parse that into an array and be able to access each of the values like masterArray[1][4] etc.</p>
  
  <p>So I'm stuck, the JavaScript is in a separate file, and so is the PHP script, I can put it in the same HTML page but I still don't know how to get it.</p>