我正在查询LinkedIn JS API以返回人员列表。该列表以JSON对象的形式返回。以下是回调函数:
.result(function (result) {
profile = result.values[0];
// Do something with the first linkedin profile in the list...
});
对象“result”返回类似以下内容:
{"values":[{"id":"123456","firstName":"Person","lastName":"One"}, {"id":"123456","firstName":"Person","lastName":"Two"}, {"id":"123456","firstName":"Person","lastName":"Three"}],"_total":3}
我看到的所有文档都使用这种语法来获取结果中的第n个项目:
var profile = result.values[n];
这在大多数浏览器中正常工作,但在IE中会抛出以下错误:
Microsoft JScript runtime error: Object doesn't support this property or method
有人有解决这个问题的想法吗?谢谢提前。
profile = ...
还是var profile = ...
? - Jochemprofile = ...
而不是var profile = ...
。加上var
已经解决了我的问题。这在IE7和IE8中失败了。但我不能将您的评论标记为正确 :( - Brian Daly