let tmpDt = "empty";
fn_get_corp_cd=function(){
axios({
method: 'get', //통신 방식
url: '/logs/getCORP_CD', //통신할 페이지
data: {} //인자로 보낼 데이터
})
.then(response=>{
console.log('console responseData',response);
tmpDt = response;
return tmpDt;
})
.catch(error=>{
//console.log(error);
tmpDt = error;
return tmpDt;
})
$("#corpcdselect").empty();
$("#corpcdselect").append(htm)
}
function resolveAfter2Seconds() {
return new Promise((resolve) => {
setTimeout(() => {
resolve(tmpDt);
}, 2000);
});
}
async function asyncCall() {
console.log('calling');
const result = await axios.post('/logs/getCORP_CD').then(response=>{
console.log(response)
});
console.log("result2 ",result);
const result2 = await axios.post('/logs/getCORP_CD').then(res=>{
console.log(res)
});
// Expected output: "resolved"
}
TestApiCall = async function(){
try {
const response = await axios.post('/logs/getCORP_CD')
console.log("response >>", response.data)
const response2 = await axios.post('/logs/getCORP_CD')
console.log("response >>", response2.data)
} catch(err) {
console.log("Error >>", err);
}
}
'study > Front' 카테고리의 다른 글
java script 오늘날짜 입력 (0) | 2023.10.25 |
---|---|
Javascript typeof. typeof undefined (0) | 2023.10.25 |
find (0) | 2023.10.24 |
모르면 손해보는 21가지 JavaScript 축약코딩 기법seokkitdo·2021년 12월 31일 (0) | 2023.10.20 |
formData axios selectbox (0) | 2023.10.16 |