-1

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?

Jahlom
  • 118
  • 5

1 Answers1

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