开发者

YQL returning table of undefined values, even though JSON object has contents

开发者 https://www.devze.com 2023-02-20 18:11 出处:网络
I\'m using Google Docs and YQL to power a job postings board. I got one version up and running at http://jsfiddle.net/N4Hb8/8/ .

I'm using Google Docs and YQL to power a job postings board. I got one version up and running at

http://jsfiddle.net/N4Hb8/8/ .

Then I modified the YQL query to only get jobs listed as "open", which returns this JSON object:

http://bit.ly/i0phfc

But the resulting table is full of "undefined"'s.

开发者_开发百科

http://jsfiddle.net/N4Hb8/10/

What went wrong?


What appears to have gone wrong is that in your first example, item is an actual object, whereas in your second example, item actually refers to the columns you want. If you console.log(item) you'll see what I mean.

More specifically, it appears that in your first example, it happens to return an array of results. In your second example, it returns a single result.

To fix your code, you'll need to handle the special case that you're returned only one item.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号