배열에Node.js | 배열을 통해 루프, 포스트 전화를 걸고 나는이 같은 Node.js를의 somethine에 전화를 걸 할
test = [] //initially an empty array
list = []//an array with 10 json object
for li in list
get_data url , li, (err,data) -> test.push data
내 get_data 방법 모양 (Node.js를위한 메신저 사용하여 커피 스크립트를) 결과를 축적 같은
get_data: (url, json_data, callback) ->
throw "JSON obj is required" unless _.isObject(json_data)
post_callback = (error, response) ->
if error
callback(error)
else
callback(undefined, response)
return
request.post {url: url, json: json_data}, post_callback
return
문제는이 '시험'배열 내가 for 루프에서 뭔가 잘못하고있는 중이 야 알고 있지만 확실하지에 request.post에서 결과를 수집 할 수 없습니다 나는 무엇
'(ERR, 데이터) -> test' 단지 test', 당신이 기대하는 어떤 것도 –
을 추가하지 않습니다'리턴'테스트 << data'할까요? –
@muistooshort 아마도 그는'test.push data'라고 쓰려고했을 것입니다. 확실하지 않다. –