2015-01-06 65 views
0

我的節點從Mongoose獲取數據併發送到網頁。 ,而不是顯示真實的數據{對象:對象對象:對象對象:對象...}。 我是新的節點,所以我不明白數據是否已經被解析,因爲jQuery.parseJSON()給出錯誤(我搜索並得出結論,數據已被解析)。那爲什麼它顯示正確?Node.js html中的JSON數據顯示不正確

$.ajax({ 
     dataType: "json", 
     url: "http://localhost:1337/users", 
     method:'GET', 
     success: function(userJSON){ 
      alert(userJSON); 
     } 
    }) 
+0

您不能提醒對象,請改用'console.log'。 –

回答

0

您可以使用console.log(JSON.stringify(userJSON));來查看JSON。