daily pastebin goal
25%
SHARE
TWEET

Untitled

a guest Feb 23rd, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     foreach ($query->result() as $row)
  3.     {
  4.         $lat = $row->geo_lat;
  5.         $lng = $row->geo_lng;
  6.         $pic = $row->picture;
  7.         echo $lat;
  8.         echo $lng;
  9.         echo "<img src="" . base_url() . $pic . ""/><br />";
  10.         //echo json_encode($row);
  11.         //echo "<pre>";
  12.         //echo print_r($row);
  13.     }
  14. ?>
  15.    
  16. var locations = ?????????;
  17. var marker, i;
  18.   for (i = 0; i < locations.length; i++) {
  19.     marker = new google.maps.Marker({
  20.       position: new google.maps.LatLng(locations[i][0], locations[i][1]),
  21.       map: map,
  22.       draggable: true
  23.     });
  24.   }
  25.    
  26. <?php
  27.     echo( "<script>" );
  28.     echo( "  var locations = " + json_encode($query->result()) + ";" );
  29.     echo( "</script>" );
  30. ?>
  31.    
  32. <script>
  33.     var js_obj=<?php echo  json_encode($result); ?>
  34.   /* now you can access this json object that is in js_obj variable and acccess any thing you want using dot operator.*/
  35. </script>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top