Phonegap GetJson奇怪输出-REST

Phonegap GetJson奇怪输出-REST,json,rest,debugging,cordova,getjson,Json,Rest,Debugging,Cordova,Getjson,我有这样的情况:(公共api我的一个测试网站) $.getJSON(“http://ee-tutz.com/entry_api/rest/read_entry/json?auth[用户名]=测试和验证[密码]=来宾和数据[输入\u id]=80”,函数(数据){ 警报(数据);//我得到[obj obj] var tweetlistHTML=“”; 对于(var i=0;i

我有这样的情况:(公共api我的一个测试网站)

$.getJSON(“http://ee-tutz.com/entry_api/rest/read_entry/json?auth[用户名]=测试和验证[密码]=来宾和数据[输入\u id]=80”,函数(数据){
警报(数据);//我得到[obj obj]
var tweetlistHTML=“”;
对于(var i=0;i'
}
var tweetList=$(“#tweetList”);
html(tweetlistHTML);
});
代码有什么问题吗? 我想输出URL结果的一些数据(例如标题)
但是它不输出标题

您可以尝试使用
JSON.stringify()
方法输出对象详细信息吗 这将让您知道返回的
对象属性

例如:提醒第一个对象的详细信息

alert(JSON.stringify(data.results[0]));
或阵列中的整个对象

alert(JSON.stringify(data.results));
您是否尝试从桌面浏览器检查结果,确定URL是否返回JSON响应。
EDIT1: 我刚刚检查了URL的响应
您需要更改数据变量语法。

data.data[i].title
而不是

data.results[i].title
EDIT2: 哎呀。我忘了更改警报代码。
警报应该是安全的

alert(JSON.stringify(data.data[0]));
或者你可以提醒整个数据

alert(JSON.stringify(data));
EDIT3:
URL返回的JSON数据
JSON数据:

{"message":"Successfully readed","code":200,"code_http":200,"data":[{"entry_id":"80","site_id":"1","channel_id":"1","author_id":"1","forum_topic_id":null,"ip_address":"86.120.164.135","title":"POP ON OP: an Interactive Real-Time Animation Object-Book","url_title":"pop-on-op-an-interactive-real-time-animation-object-book","status":"open","versioning_enabled":"y","view_count_one":"0","view_count_two":"0","view_count_three":"0","view_count_four":"0","allow_comments":"y","sticky":"n","entry_date":"1405812194","year":"2014","month":"07","day":"20","expiration_date":"0","comment_expiration_date":"0","edit_date":"20140719233024","recent_comment_date":"0","comment_total":"0","main_content":"POP ON OP is an interactive real-time animation object-book in which you can experience movement directly on paper with a special film.","propietati":"74%$23,959 Funded &nbsp; ","testfisier":false,"poza":"<img alt=\"Photo little\" class=\"fit\" height=\"150\" src=\"https:\/\/s3.amazonaws.com\/ksr\/projects\/1055334\/photo-little.jpg?1404412397\" width=\"200\" \/>","descriere":" POP ON OP is an interactive real-time animation object-book in which you can experience movement directly on paper with a special film. ","autor":"  by PARRATORO  ","categories":[]}],"id":"80"}
{“消息”:“已成功阅读”,“code”:200,“code\u http”:200,“数据”:[{“条目id”:“80”,“站点id”:“1”,“频道id”:“1”,“作者id”:“1”,“论坛主题id”:“null”,“ip地址”:“86.120.164.135”,“标题”:“弹出操作:交互式实时动画对象书”,“url\u标题”:“弹出操作:交互式实时动画对象书”,“状态”:“打开”,“已启用版本控制”:“y”、“查看计数一”:“0”、“查看计数二”:“0”、“查看计数三”:“0”、“查看计数四”:“0”、“允许注释”:“y”、“粘滞”:“n”、“条目日期”:“1405812194”、“年份”:“2014”、“月份”:“07”、“日期”:“20”、“到期日期”:“0”、“注释到期日期”:“0”、“编辑日期”:“20140719233024”、“最近注释日期”:“0”、“注释总数”:“0”、“注释日期”:“0”、“0”、“0”主要内容:“POP ON OP是一本交互式实时动画对象书,您可以通过一部特殊电影直接在纸上体验运动。”,“propietati”:“74%$23959资助”,“testfisier”:假,“poza”:“描述”:POP ON OP是一种交互式实时动画对象书,在其中,您可以通过一部特殊影片直接在纸上体验运动。”,“自动”:“由PARRATORO制作”,“类别”:[]}],“id”:“80”}

对警报进行了更改,但未定义警报,还替换了代码,代码未显示在页面上。:(以及警报(JSON.stringify(data.results[0]);在您显示的代码中,您会收到警报
\\here我得到[obj obj]
。你是否收到警报?是的,我在最后几分钟完成了并编写了解决方案,现在我遇到了另一个问题,Json数据类似于{“uselesstuff”:“value”,“dataiwant”:[{obj},{obj}}}你需要使用
for(var I=0;I
不客气。如果答案解决了您的问题,请接受。下次请提供尽可能多的信息,以便其他人能够轻松理解您的问题。
{"message":"Successfully readed","code":200,"code_http":200,"data":[{"entry_id":"80","site_id":"1","channel_id":"1","author_id":"1","forum_topic_id":null,"ip_address":"86.120.164.135","title":"POP ON OP: an Interactive Real-Time Animation Object-Book","url_title":"pop-on-op-an-interactive-real-time-animation-object-book","status":"open","versioning_enabled":"y","view_count_one":"0","view_count_two":"0","view_count_three":"0","view_count_four":"0","allow_comments":"y","sticky":"n","entry_date":"1405812194","year":"2014","month":"07","day":"20","expiration_date":"0","comment_expiration_date":"0","edit_date":"20140719233024","recent_comment_date":"0","comment_total":"0","main_content":"POP ON OP is an interactive real-time animation object-book in which you can experience movement directly on paper with a special film.","propietati":"74%$23,959 Funded &nbsp; ","testfisier":false,"poza":"<img alt=\"Photo little\" class=\"fit\" height=\"150\" src=\"https:\/\/s3.amazonaws.com\/ksr\/projects\/1055334\/photo-little.jpg?1404412397\" width=\"200\" \/>","descriere":" POP ON OP is an interactive real-time animation object-book in which you can experience movement directly on paper with a special film. ","autor":"  by PARRATORO  ","categories":[]}],"id":"80"}