對不起,如果這是一個愚蠢的問題。我正在嘗試使用另一個項目的API向服務器發出一些請求。服務器返回的JSON數據具有以下格式:{ "head": { "link": [], "vars": [ "s", "p", "o" ] },"results": { "distinct": false, "ordered": true, "bindings":
等等。然而,當我撥打電話,通過我的項目在流星的反應是這樣的"\n{ \"head\": { \"link\": [], \"vars\": [ \"s\", \"p\", \"o\" ] },\n \"results\": { \"distinct\": false, \"ordered\": true, \"bindings\":
我的代碼看起來像這樣從服務器調用中檢索到的正確格式的JSON數據
Meteor.call("getURL",'serverURL',{},function(err,res){
if(err){
alert('Query not found: '+err);
}
if(!err){
onsole.log(JSON.stringify(res));
}
}
我怎麼能顯示從服務器沒有\ n和\等反應?
的反應已經是一個字符串。嘗試'console.log(res)'而不是'console.log(JSON.stringify(res));' – blo0p3r