Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- Spring Controller return
- SpringBatch 스키마
- react link
- Spring JPA
- JPA Insert
- javascript 함수
- 텍스트가 많은 경우
- react Quill
- react Page
- Javascript
- javascript 기초
- react react-router-dom v6
- react jsx if
- Docker Windows 설치
- spring security
- 코드 중복제거
- spring builder
- editor Quill
- javascrpit 기초
- react quill custom
- react forwardRef
- springbatch chunk
- springbatch
- Spring CORS
- react
- Spring DTO
- spring
- Spring Entity
- step 테이블
- JPA Update\
Archives
- Today
- Total
천천히 알아보는 코딩공부
javascript weather API 이용 (1) - navigator 본문
weather.js
function onGeoOk(position)
{
const lat = position.coords.latitude;
const lng = position.coords.longitude;
console.log("You live in",lat, lng);
}
function onGeoError()
{
alert("error");
}
navigator.geolocation.getCurrentPosition(onGeoOk, onGeoError);
weather API를 이용하기전에 현재 사용중인 위치를 구해준다.
navigator.geolocation.getCurrentPosition
- 현재 위도, 경도 등 위치(좌표) 알려줍니다
- OnGeoOk 함수 성공할때 출럭 coords.latitude 위도 coords.longitude 경도
- onGeoError 실패할때 출력
Comments