告诉我我在这里失去了什么。我有以下JavaScript对象。JavaScript对象属性总是返回undefined
[ { id: '16B0C2FC-A008-4E8A-849B-DB1251C8CABD',
handle: '123',
userId: 'ABC123'} ]
当i执行以下
success: function (registration) {
console.log(registration);
console.log(registration.handle);
控制台日志写出该对象如上述定义。但是,当我做registration.handle时,我收到一个错误,说“未定义”。如果注册是上述对象,为什么registration.handle不起作用?
我错过了什么?
除了答案,你可能还需要解析响应, 'JSON.parse'。 –
这个问题似乎是无关紧要的,因为它对于单个代码库来说太具体了。 – jprofitt