- Promise
- Ajax
- callback function
- await
์ฃผ๋ก ์๋ฒ์์ ๋ฐ์์จ ๋ฐ์ดํฐ๋ฅผ ํ๋ฉด์ ํ์ํ ๋ ์ฌ์ฉํ๋ค๊ณ ํ๋ค.
์ผ๋ฐ์ ์ผ๋ก ์น์ดํ๋ฆฌ์ผ์ด์ ์ ๊ตฌํํ ๋ ์๋ฒ์์ ๋ฐ์ดํฐ๋ฅผ ์์ฒญํ๊ณ ๋ฐ์์ค๊ธฐ ์ํด API๋ฅผ ์ฌ์ฉํ๋๋ฐ, API๊ฐ ์คํ๋๋ฉด ์๋ฒ์ ๋ฐ์ดํฐ๋ฅผ ๋ณด๋ด๋ฌ๋ผ๋ ์์ฒญ์ ํ๋๋ฐ, ์ฌ๊ธฐ์ ๋ฐ์ดํฐ๋ฅผ ๋ฐ์์ค๊ธฐ๋ ์ ์ ๋ง์น ๋ฐ์ดํฐ๋ฅผ ๋ค ๋ฐ์์จ ๊ฒ์ฒ๋ผ ์ฌ๊ธฐ๊ณ ํ๋ฉด์ ๋ฐ์ดํฐ๋ฅผ ํ์ํ๋ ค๊ณ ํ๋ฉด ์ค๋ฅ๊ฐ ๋ฐ์ํ๊ฑฐ๋ ๋น ํ๋ฉด์ด ๋ฌ๋ค. ์ด๋ฐ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํ ๋ฐฉ๋ฒ ์ค ํ๋๊ฐpromise
์ด๋ค.
์ถ์ฒ : https://joshua1988.github.io/web-development/javascript/promise-for-beginners/
$.get('url ์ฃผ์/products/1', function(response) {
// ...
});