HTML code
<div id="formulario">
<h1>Posicionamento de CEO</h1>
<form method="POST" style="width: 500px;">
<div class="form-group">
<label class="control-label " for="id_identification">Identificação</label>
<div class=" ">enter code here
<input type="text" name="identification" maxlength="256" class=" form-control" required="" id="id_identification">
</div>
</div>
<div class="form-group">
<label class="control-label " for="id_geolocation">Geolocalização</label>
<div class=" ">
<input type="text" name="geolocation" maxlength="100" class=" form-control" required="" id="id_geolocation">
</div
<button type="button" onclick="start()" class="botao">Clique aqui para carregar
mapa</button>
</form>
</div>
Javascript code that opens the map and captures the coordinate when I click on the map.
async function sendCoordsToMyApi(evt) {
const coords = {
lat: evt.latLng.lat(),
lng: evt.latLng.lng()
};
console.log("vou enviar as coordenadas para api:", coords);
alert(JSON.stringify(coords));
I need to enter the coordinate of the constant coords in the form in the input field id=”id_geolocation”
can you help me?