Can you please show me any example about the structure of code I've
provided?

Thanks

On Tue, Feb 13, 2018 at 2:27 AM, Etienne Robillard <tkad...@yandex.com>
wrote:

> Hi Shazia,
>
> You can make a XHR (Ajax) request in javascript to send the data to a
> django callback.
>
> HTH,
>
> Etienne
>
> Le 2018-02-12 à 18:04, Shazia Nusrat a écrit :
>
> Hi,
>
> Below is the code for Javascript from Django template Google Maps API. I
> need to be able to save this in my Django models with JSON response. I am
> new user so an example will be really a great help.
>
> Precisely I need to be able to save coordinates like latitude and
> longitude and then convert it to an address.
>
> Thanks
>
> var map, infoWindow;
>       function initMap() {
>         map = new google.maps.Map(document.getElementById('map'), {
>           center: {lat: -34.397, lng: 150.644},
>           zoom: 6
>         });
>         infoWindow = new google.maps.InfoWindow;
>
>         // Try HTML5 geolocation.
>         if (navigator.geolocation) {
>           navigator.geolocation.getCurrentPosition(function(position) {
>             var pos = {
>               lat: position.coords.latitude,
>               lng: position.coords.longitude
>             };
>
>             infoWindow.setPosition(pos);
>             infoWindow.setContent('Location found.');
>             infoWindow.open(map);
>             map.setCenter(pos);
>           }, function() {
>             handleLocationError(true, infoWindow, map.getCenter());
>           });
>         } else {
>           // Browser doesn't support Geolocation
>           handleLocationError(false, infoWindow, map.getCenter());
>         }
>       }
>
>       function handleLocationError(browserHasGeolocation, infoWindow, pos) {
>         infoWindow.setPosition(pos);
>         infoWindow.setContent(browserHasGeolocation ?
>                               'Error: The Geolocation service failed.' :
>                               'Error: Your browser doesn\'t support 
> geolocation.');
>         infoWindow.open(map);
>       }
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAD83tOzabkiPgniqofN6BH2tLogei
> GE9JaZ5rppi3f44Hb0ybA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAD83tOzabkiPgniqofN6BH2tLogeiGE9JaZ5rppi3f44Hb0ybA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> Etienne Robillardtkadm30@yandex.comhttps://www.isotopesoftware.ca/
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAD83tOyZn16gV7%3D2am9W8je-Q4mQALNNR5TAgPwYvVs%2B_n%2B9aQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to