【发布时间】:2010-11-02 07:54:46
【问题描述】:
好的,我对 jQuery 和 json 有点陌生。如果我使用 json 作为返回类型,我还能从 XMLHttpRequest 对象中检索 responseText 吗?
这是我正在使用的代码:
json response: {"clients": []}
$.ajax({
type: "POST",
url: "/myurl/whatever.php",
data: myData,
dataType: "json",
success: function(msg){
status.html(msg[0]);
},
error: function(msg) {
status.html("Error: " + msg[0]);
}
});
如果我想输出 json 响应或者我遗漏了什么,使用 msg[0] 是否正确?
我怎样才能仍然使用上面的代码和 XMLHttpRequest 来获取状态、responseText 等。
谢谢大家!
【问题讨论】:
标签: json jquery xmlhttprequest