[英]Pulling JSON body from API Response using Javascript
我正在使用parse.com API服務器,該服務器已使用AJAX在Javascript中成功通信。
我將返回的輸出寫入瀏覽器控制台,如下所示:
$.ajax(settings).done(function(response) {
console.log(response);
})
.fail(function(response){
console.log("Fail Return is: " + response);
});
在此響應中是一個JSON正文,其中包含如下消息:
{
"code": 202,
"error": "Account already exists for this username."
}
我將如何從響應中提取出此內容並說成單獨的控制台消息?
好,
在外部獲得幫助后,此工作即可完成:
console.log("Fail Return is: " + temp.error);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.