title: dynamically populate google maps location from db
body: <p>i have a latitude and longitude of particular user in db .. i am getting the values by using jquery .. here is what i am doing</p>
  
  <pre><code>var auto_refresh = setInterval(
          function ()
          {
              $.get('http://localhost/Location/locate', function(data){
  
               $('.latitude').html(data.lat);
               $('.longitude').html(data.long);
  
  
               }, 'json');
  
  
  
          }, 1000);
  </code></pre>
  
  <p>when i was getting the location from php i was doing this </p>
  
  <pre><code>    'localize' =&gt; false,
      'latitude' =&gt; $latitude,
      'longitude' =&gt;  $longitude,
      'address' =&gt; $address,
      'marker' =&gt; true,
  </code></pre>
  
  <p>now i am doing this but is giving me syntax error </p>
  
  <pre><code>      'latitude' =&gt; ?&gt;&lt;div class = 'latitude'&gt;&lt;/div&gt;&lt;?php ,
      'longitude' =&gt; ?&gt;&lt;div class = 'longitude'&gt;&lt;/div&gt;&lt;?php ,
  </code></pre>
  
  <p>and the other thing i like to ask is that is this the best approach for getting the location without page refresh .. or there is something else too .</p>