Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
Waqas Abbasi
@Waqas909
if it's Longitude and lattitute, then you can make it so it tells the weather of the person using it
Stefaan Walleghem
@lawfets
@Waqas909 I did, still doesn't work
but I'll first try another way of activating the call
Waqas Abbasi
@Waqas909
@lawfets You should be only getting this much
{"coord":{"lon":139,"lat":35},
"sys":{"country":"JP","sunrise":1369769524,"sunset":1369821049},
"weather":[{"id":804,"main":"clouds","description":"overcast clouds","icon":"04n"}],
"main":{"temp":289.5,"humidity":89,"pressure":1013,"temp_min":287.04,"temp_max":292.04},
"wind":{"speed":7.31,"deg":187.002},
"rain":{"3h":0},
"clouds":{"all":92},
"dt":1369824698,
"id":1851632,
"name":"Shuzenji",
"cod":200}
Stefaan Walleghem
@lawfets
@Waqas909 If I test it out now, with bruges, it only gives that amount, if I try it in the code, it gives nothing
@Waqas909 as I said, the url is not the problem now I use the city name, it's something in the code that goes wrong
maybe now I'll try to add that https line before the http
nope, nothing yet, I'll copy my code to brackets and put it on my local server and see what I get there
Waqas Abbasi
@Waqas909
@lawfets try the crossorigin
and put your api link right afte rit
https://crossorigin.me/http://api.openweathermap.org/data/2.5/forecast/city?id=3029799&APPID=88b75e0f51b809b601a2e4f76955cdf0&callback=?
Get your api call from that link
Stefaan Walleghem
@lawfets
@Waqas909 I did, doesn't work
Waqas Abbasi
@Waqas909
can u link me? ur project?
Stefaan Walleghem
@lawfets
Waqas Abbasi
@Waqas909
@lawfets Yes indeed there is a problem in your code
you need a callback function, if it is succesfull in getting the JSON you want it to get

~~~
$(document).ready(function(){

$("#testWeer").on("click", function(){

$.getJSON("https://api.openweathermap.org/data/2.5/weather?q=Bruges&APPID=88b75e0f51b809b601a2e4f76955cdf0&callback=", function(data){

});

});
});

oops
$(document).ready(function(){

  $("#testWeer").on("click", function(){

    $.getJSON("https://api.openweathermap.org/data/2.5/weather?q=Bruges&APPID=88b75e0f51b809b601a2e4f76955cdf0&callback=", function(data){


});




  });
});
Stefaan Walleghem
@lawfets
I used the function data all the time and It didn't matter
Waqas Abbasi
@Waqas909
function(data) // The data is the JSON it got
try it :)
Stefaan Walleghem
@lawfets
nope , not working
Waqas Abbasi
@Waqas909
@lawfets You are using "https"
for your api link
@lawfets openweather doesnt support that, it's http
Stefaan Walleghem
@lawfets
@Waqas909 yes, just saw it, it's because I just tried https, but it doesn't work with http either
Waqas Abbasi
@Waqas909

@lawfets Like I said add

https://crossorigin.me/http://api.openweathermap.org/data/2.5/forecast/city?id=3029799&APPID=88b75e0f51b809b601a2e4f76955cdf0&callback=?

instead of

https://api.openweathermap.org/data/2.5/weather?q=Bruges&APPID=88b75e0f51b809b601a2e4f76955cdf0&callback="
you have to use crossorgiin.me
Stefaan Walleghem
@lawfets
it doesn't work
Waqas Abbasi
@Waqas909
to make codepen.io think it's a secure connecting you're getting your JSON from
Sorin Ruse
@sorinr
@lawfets example
Stefaan Walleghem
@lawfets
var data = $.getJSON("https://crossorigin.me/http://api.openweathermap.org/data/2.5/weather?q=Bruges&APPID=88b75e0f51b809b601a2e4f76955cdf0&callback=?", function(data){return $(".arrayWeather").html(data);})
it's really weird
alpox
@alpox
@lawfets Remove &callback=? from the url and try again
Stefaan Walleghem
@lawfets
nope, not working
Waqas Abbasi
@Waqas909
@lawfets Yea I think you should go with @sorinr 's approach to this. it seems the website is offline
alpox
@alpox
@lawfets Try it without crossorigin.me?
Stefaan Walleghem
@lawfets
you know what, it doesn't work
Sorin Ruse
@sorinr
@lawfets change your pen from https to http. have you tried my example?
Stefaan Walleghem
@lawfets
@alpox @sorinr @Waqas909 thank you, I don't know what the difference was between sorins and my line (tried to write it exactly the same) but when I copy pasted the line, it worked
CamperBot
@camperbot
lawfets sends brownie points to @alpox and @sorinr and @waqas909 :sparkles: :thumbsup: :sparkles:
:cookie: 274 | @waqas909 |http://www.freecodecamp.com/waqas909
:cookie: 674 | @alpox |http://www.freecodecamp.com/alpox
:cookie: 895 | @sorinr |http://www.freecodecamp.com/sorinr
alpox
@alpox
@lawfets It works :-) but your problem is what @sorinr says. Access codepen from http and make the call without callback=? and without crossorigin.me

@lawfets The difference was probably that part:

function(data){html(JSON.stringify(data));
 });

the function html doesn't exist. there should have been some jquery selector before it