I'm not really sure what you meant here. Anyways, there's plenty of good JS frameworks like jQuery to allow you to write Ajax functions to send a JSON array for post-processing in Django.

Etienne

Le 2018-02-13 à 08:34, Shazia Nusrat a écrit :
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 <mailto: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
    varmap,infoWindow;functioninitMap(){        map
    =newgoogle.maps.Map(document.getElementById('map'),{         
    center:{lat:-34.397,lng:150.644},          zoom:6});       
    infoWindow =newgoogle.maps.InfoWindow;// Try HTML5
    geolocation.if(navigator.geolocation){         
    navigator.geolocation.getCurrentPosition(function(position){varpos
    ={              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());}}functionhandleLocationError(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
    <mailto:django-users+unsubscr...@googlegroups.com>.
    To post to this group, send email to
    django-users@googlegroups.com <mailto:django-users@googlegroups.com>.
    Visit this group at https://groups.google.com/group/django-users
    <https://groups.google.com/group/django-users>.
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/django-users/CAD83tOzabkiPgniqofN6BH2tLogeiGE9JaZ5rppi3f44Hb0ybA%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
    <https://groups.google.com/d/optout>.

-- Etienne Robillard
    tkad...@yandex.com <mailto:tkad...@yandex.com>
    https://www.isotopesoftware.ca/ <https://www.isotopesoftware.ca/>



--
Etienne Robillard
tkad...@yandex.com
https://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/42a3efaf-7a67-b436-d297-be9d3dfcdad7%40yandex.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to