Can someone show me using the code used in the course to get a location from the user(current or any other) and then use it to show Google map with banks or schools api.ai?
Asked
Active
Viewed 296 times
-1
-
I am using facebook messenger – Jahlom Jun 07 '17 at 08:46
1 Answers
0
You can trace user location without Google maps. Use geolocation API: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/Using_geolocation
Geolocation API supports all latest browser including mobile devices.
You can get the user's current location as given below,
navigator.geolocation.getCurrentPosition(function(position) {
do_something(position.coords.latitude, position.coords.longitude);
});
Within the callback, you can make an external AJAX request to send this information to the remote server.
Hope this helps.

abhijeetwebdev
- 366
- 1
- 4
- 14
-
Thanks but I omitted something in the question. I am doing this in the api.ai machine learning platform. – Jahlom Jun 07 '17 at 08:43
-
-