refactor javascript
can get latlong of input