http://localhost:2000/WebService/Handler.ashx?d=ck
查看 URL 时的响应:
{"Status":"OK","Message":"0","Info":"(none)"}
使用 JQuery 如何从中提取?我了解您如何进行 POST 和发送,但对于如何从中提取内容几乎没有什么损失。我使用 GET 吗?
我正在做类似 $.get("URL HERE"...?
最佳答案
$.ajax({
url:"...",
dateType: "json", // <=== you expect "JSON" string
success: function(data){
alert(data.Status); // Extract the data from the response.
alert(data.Message);
alert(data.Info);
}
});
或者简写 getJSON
函数:
$.getJSON(url,function(data){
data.Status;
...
});
关于javascript - 使用jquery从ajax响应中提取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11053822/