I'm new to development with this API and would like to show on the map that I'm developing the user's current position.
My code:
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=AIzaSyB7s0zDs4RMWrpqWjAmr7OD-BQbq8LubZk&sensor=false"></script><script>vargeocoder;varmap;varmarker;functioninitialize(){varlatlng=newgoogle.maps.LatLng(-18.8800397,-47.05878999999999);varoptions={zoom:5,center:latlng,mapTypeId:google.maps.MapTypeId.ROADMAP};map=newgoogle.maps.Map(document.getElementById("mapa"), options);
geocoder = new google.maps.Geocoder();
marker = new google.maps.Marker({
map: map,
draggable: true,
});
marker.setPosition(latlng);
}
$(document).ready(function () {
initialize();
});