<input type="text" id="my_input">
<button onClick="getCoordinates()">Get Coordinates</button>
<pre id="my_pre"></pre>
govmap.setToken("...");
function getCoordinates() {
const address = document.getElementById("my_input").value;
govmap
.geocode({
keyword: address,
type: govmap.geocodeType.AccuracyOnly
})
.then(
(response) =>
(document.getElementById("my_pre").textContent = JSON.stringify(
response,
null,
2
))
)
.fail(
(res) =>
(document.getElementById("my_pre").textContent = JSON.stringify(
res.responseJSON,
null,
2
))
);
}
This Pen doesn't use any external CSS resources.