YQL returning table of undefined values, even though JSON object has contents
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.
精彩评论