<div id="target> </div>
<p id="location"></p>
  <script>
      var c=1;
var x = document.getElementById("location");
window.setInterval(function() {
    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(showPosition);
    } else {
        x.innerHTML = "Geolocation is not supported by this browser.";
    }
}, 5000);

function showPosition(position) {
    ajax('{{=URL("default","getaddress")}}'  + '?latitude=' + 
position.coords.latitude + '&longitude=' + position.coords.longitude 
 ,[],'target');
    c=c+1;
    x.innerHTML =c+"  " + "Latitude: " + position.coords.latitude + 
    "<br>Longitude: " + position.coords.longitude+ "<br>";
    
}


so as you can see I am printing in target and location. The one with id 
location also prints autoincremented c and the one with ajax call prints 
auto incremented session.count in target However I see that ajax one will 
work only when that particular tab is open. I want this to work even if i 
am working on another tab.   

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to