I've got a pre populated form with gps coordinates and I am trying to search a database.
<form>
<mat-toolbar color="primary">
<mat-toolbar-row style="justify-content: center;" id="test"> Yonder </mat-toolbar-row>
<br>
<mat-toolbar-row style="justify-content: center;"> <input id="geoSearch" type="text" value="{{coords}}"> </mat-toolbar-row>
<mat-toolbar-row style="justify-content: center;"> <button type="submit" class="subMitButton" id="location-button" mat-raised-button onclick="window.location.reload();" color="accent"> Locate </button> </mat-toolbar-row>
</mat-toolbar>
<br>
</form>
and my backend code
app.get('/api/animals',(req, res, next) => {
Animal.find({})
.then(documents => {
res.status(200).json({
message: 'success',
animals: documents
});
});
How can I send the data from the form to be used in the find query?
Thanks!