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
@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

Stefaan Walleghem
@lawfets
oh, now I see, html is between {}
nope, that was the same, my mistake
oh, it doesn't put it in the arrayWeather class div
that's why I used .html because I used{ (".arrayWeather").html
but why does it work in the third challenge of JSON api
Sorin Ruse
@sorinr
@lawfets nothe that $(".arrayWeather").html... must be within the scope of function(data). the data response is not avilable out of scope
Stefaan Walleghem
@lawfets
@sorinr I understand but watch this
$("#getMessage").on("click", function(){
      // Only change code below this line.
      $.getJSON("/json/cats.json", function(json) {
  $(".message").html(JSON.stringify(json));
});