wx.request({
url: 'http://api.douban.com/v2/movie/in_theaters',
data: {},
header: {
"Content-Type": "application/json"
},
success: function (res) {
// console.log(res.data.subjects);
// 看开发者api,一定要看清楚给的信息
_this.setData({
list: res.data.subjects
});
}
})
出现下面的报错
原来是开发工具升级后,请求的header的Content-type写法变了(我现在使用的开发工具版本为0.11),需要改为
header:{
"Content-Type":"json"
},
这样就可以正常访问了;