det*_*llt 1 javascript ajax jquery json
我有一个ASP.NET MVC Web API,我从$ .ajax()方法调用.从我的API返回正确的JSON,但无法访问该对象.尝试记录"名称"的值时,我的控制台收到的错误是:
未捕获的TypeError:无法读取未定义的属性"名称"
JSON:
[{"id":2,"Name":"thom","Picture":"thom.jpg","About":"I'm a guy. This is my profile. Now quit staring and get out of here.","Location":"London"}]
Run Code Online (Sandbox Code Playgroud)
jQuery的:
$.ajax({
cache:false,
type: 'GET',
dataType: 'json',
url: 'http://localhost:3235/Users/searchUsers?callback=?&searchString=' + searchString,
complete: function (data) {
console.log(data[0].Name);
}
});
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激.谢谢!