일정한 시간이 지나면 함수를 반환하고 싶습니다. 아래 함수에서 리턴 값이 작동하지 않았습니다 (경고가 트리거되었습니다).자바 스크립트에서 프로세서를 죽이지 않고 구현 지연
문제는 내 입니다. handleRequestStateChange myArray를 초기화합니다.
function() {
xmlHttp.open("POST", "xxx", true);
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-Length", 10);
xmlHttp.onreadystatechange = handleRequestStateChange;
xmlHttp.send(locParam);
setTimeout(function() { return myArray; }, 5000);
alert("end sleep");
}
고마워요!
실제로 여기 첫 번째 기능에서 반환하지 않습니다. 당신은 내적인 기능에서 돌아오고 있습니다, 그래서 그것은 첫 번째 것에서 돌아 오지 않습니다. – Pavunkumar
예, 알고 있습니다 만 원래 함수를 어떻게 반환합니까? –