Weather

무료
분류별 fyhao | 업데이트됨 a month ago | Data
Health Check

N/A

모든 토론으로 돌아가기

how to access values in the response?

Rapid account: Tomjohnson 1492
tomjohnson1492
9 years ago

Can you provide more guidance on accessing values in the response for the weatherdata endpoint? Using this tutorial code, http://docs.mashape.com/javascript, I want to replace data.source with something like data.query.results.channel.description to print the description to the page. However, each time I try this, I get an error msg that says “Uncaught TypeError: Cannot read property ‘results’ of undefined”.

What is the proper dot notation to access some of the values in the response?

Rapid account: Tomjohnson 1492
tomjohnson1492 Commented 9 years ago

Figured it out. There was a typo in the code sample. datatype should have been dataType. This was causing the response to be passed as text instead of JSON.

아래에 의견을 추가하고 토론에 참여하세요.

새 댓글을 게시하려면 로그인 / 가입