admin管理员组文章数量:1356882
Im trying to get a working http.get client function working in Meteor. However I keep getting my own page as result.
Here is my code:
Meteor.http.get("api.openweathermap/data/2.5/weather?q=London,uk", function (error, result) {
if(error) {
console.log('http get FAILED!');
} else {
console.log('http get SUCCES');
if (result.statusCode === 200) {
console.log('Status code = 200!');
console.log(result.content);
}
}
});
I would expect that it returned a json object containing weather information. Do I miss something here?
Thanks.
Im trying to get a working http.get client function working in Meteor. However I keep getting my own page as result.
Here is my code:
Meteor.http.get("api.openweathermap/data/2.5/weather?q=London,uk", function (error, result) {
if(error) {
console.log('http get FAILED!');
} else {
console.log('http get SUCCES');
if (result.statusCode === 200) {
console.log('Status code = 200!');
console.log(result.content);
}
}
});
I would expect that it returned a json object containing weather information. Do I miss something here?
Thanks.
Share Improve this question edited Jul 11, 2013 at 11:59 user229044♦ 240k41 gold badges344 silver badges346 bronze badges asked Jul 11, 2013 at 11:24 Arno KerkmeijerArno Kerkmeijer 711 silver badge3 bronze badges 1- Found my solution! In the first place you need to add the http:// of https:// in front of the URL. I used the Meteor Methods to do the stuff for me: – Arno Kerkmeijer Commented Jul 11, 2013 at 11:56
1 Answer
Reset to default 8Please update the url by adding http://
at beginning.
Moreover make this call from your server, i.e. Make a method that contains the above code and call that method via Meteor.call()
;
Please see Meteor.methods() and Meteor.call()
本文标签: javascriptMeteor http get callStack Overflow
版权声明:本文标题:javascript - Meteor http get call - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744059615a2583886.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论