我正在进行 ajax 调用并在响应中获取一个对象。
当我尝试获取 responseText 时,它告诉我它是未定义的:
var results = API.get('users', { username: un, userpass: pw } );
console.log(results); //the object response below
console.log(results.responseText); // returns undefined
对象看起来像(我删除了响应中无用的部分):
Object {readyState: 1, getResponseHeader: function, getAllResponseHeaders: function, setRequestHeader: function, overrideMimeType: function…}
responseJSON: Object
responseText: "{"orderBy":"","orderDesc":false,"rows":[{"id":"26","name":"Jordan Simon","username":"jordan","userpass":"jordan"}],"totalResults":1,"totalPages":1,"pageSize":1,"currentPage":1}"
statusText: "OK"
__proto__: Object
我究竟做错了什么?你能举个例子吗?