【发布时间】:2017-08-15 08:07:14
【问题描述】:
getData() {
return fetch("http://bitcfeedcms.rf.gd/script.php")
.then(response => {
console.log(response);
response.json();
})
.then(responseJson => {
this.setState({ data: responseJson });
})
.catch(error => {
console.error(error);
});
}
我还尝试将 ?l=1 设置为“ bitcfeedcms.rf.gd/script.php?l=1 ”。 主要的 json 文件是“bitcfeedcms.rf.gd/feed_data.json”。所以我也尝试了“http://bitcfeedcms.rf.gd/feed_data.json?l=1”,但没有任何改变
我现在必须做些什么来获取 json 数据并在我的应用程序中使用它...请帮助
【问题讨论】:
-
你看到console.log了吗?
-
是的...我查过了。
-
响应日志在这里...bitcfeedcms.rf.gd/1.png
-
我认为您的问题在于 php 脚本。您是否尝试向 Postman 提出请求?响应以 HTML 格式返回。
-
邮递员给我 html 作为响应....请参阅这里邮递员 bitcfeedcms.rf.gd/postman%20error.png 的响应
标签: javascript php json react-native