sending the directionsResult object to the web server

28 views
Skip to first unread message

skater

unread,
Sep 15, 2011, 6:03:35 AM9/15/11
to google-map...@googlegroups.com
Hi. 
I faced a task I can't resolve.
I have a DirectionResult object on the client side (in my .js file) which I need send to the server (to the Python function) and put it into the database (MongoDB).
How can I do this?

Now I'm trying to put the object into JSON string
for ex:
 theRoute = JSON.stringify(directionsDisplay.getDirections());
then I'm sending it to server using POST method
$.post("/ajax/saveRoutePyth/", { csrfmiddlewaretoken: $('input[name=csrfmiddlewaretoken]').val(), parName:name, parDesc:desc, parRoute:theRoute}, function(pois) { ....
But when I watch it on the server I can't see any functions which were inside the object.
Then I put the object into DB

When I'm trying to send this object back to client and do directionsDisplay.setDirections(object) this route doesn't appear on the map. 

I wonder if this happens because of any functions were lost.
Am I right and if so how can I send this object to the server not using JSON?
Thanks a lot for your help
PS trying to solve it for 2 days....

  

Rossko

unread,
Sep 15, 2011, 7:51:21 AM9/15/11
to Google Maps JavaScript API v3
> I have a DirectionResult object on the client side (in my .js file) which I
> need send to the server (to the Python function) and put it into the
> database (MongoDB).
> How can I do this?

Previous discussion
http://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/3e03797f188f0c2e/515ec25e2eded0a1

The key is that its a directions result _object_ not simple JSON

You also need to be wary of terms of use
Reply all
Reply to author
Forward
0 new messages