javascript - Meteor http get call - Stack Overflow

Im trying to get a working http.get client function working in Meteor. However I keep getting my own p

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
Add a ment  | 

1 Answer 1

Reset to default 8

Please 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()

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744059615a4551538.html

相关推荐

  • javascript - Meteor http get call - Stack Overflow

    Im trying to get a working http.get client function working in Meteor. However I keep getting my own p

    9天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信