Use chrome JS console. Is the ajax call executed?
On Thursday, 1 September 2016 13:31:11 UTC-5, @brooks wrote:
>
>
> I am doing the following to pass the javascript variable from the view to
> the controller:
> ######default/rough2.html
>
> {{extend 'layout.html'}}
>
> <p id="demo">
>
> </p>
> <script>
>
> var x=document.getElementById("demo");
> jQuery(document).ready(function(){
> geolocation();
> })
>
> function geolocation() {
> if (navigator.geolocation) {
> navigator.geolocation.getCurrentPosition(showPosition);
>
> } else {
> x.innerHTML = "Geolocation is not supported by this browser.";
> }
> }
>
> function showPosition(position) {
> var lat = position.coords.latitude;
> var lon= position.coords.longitude;
>
>
> ajax('{{=URL('default','rough3')}}'+'?lat='+lat+'&lon='+lon,[],':eval');
> }
>
> </script>
>
>
> #####rough3() function
> def rough3():
> lat1=request.vars.lat
> lon1=request.vars.lon
> ...........................
> .......................
>
> But it is "not getting redirected to rough3.html".I do not understand
> why?Please help me with this.I am really troubled with this.
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.