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
JD Tadlock
@jdtdesigns
both return a json object
Eric Chung
@chungeric
And do I have to use ajax instead of what i've done?
JD Tadlock
@jdtdesigns
jsonp is just insecure
@chungeric .getJSON() is the shorthand for .ajax()
same thing, just less code
Nathan
@Nathandim
should we use .ajax instead of .getJSON for queries on codepen then?
JD Tadlock
@jdtdesigns
nope
like i said, .getJSON() is the shorthand that does a few things for you that you'd have to hard code in .ajax()
Nathan
@Nathandim
Tom
@moT01
@Nathandim didnt declare the variable?
JD Tadlock
@jdtdesigns
@Nathandim Simply add '&callback=?' to the end of the url
Nathan
@Nathandim
oh the callback
JD Tadlock
@jdtdesigns
codepen requires the api return jsonp if the api server has a CORS header present
Nathan
@Nathandim
it works now :thinking: hmm
I think I should learn more about jsonp and CORS headers
thank you @moT01 @jdtdesigns
CamperBot
@camperbot
nathandim sends brownie points to @mot01 and @jdtdesigns :sparkles: :thumbsup: :sparkles:
:cookie: 887 | @jdtdesigns |http://www.freecodecamp.com/jdtdesigns
:cookie: 473 | @mot01 |http://www.freecodecamp.com/mot01
JD Tadlock
@jdtdesigns
don't worry, you will lol
a lot of your life in coding a web app will be dealing with CORS issues :D
Nathan
@Nathandim
lol :D
Eric Chung
@chungeric
$(document).ready( function(){
  $.getJSON("http://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en&jsonp=?", function(json){
    $(".quote").html(json.quoteText);
  });
});
I've done this, still won't work :/
Nathan
@Nathandim
@chungeric Check this
CamperBot
@camperbot
:bulb: to format code use backticks! ``` more info
Nathan
@Nathandim
$(document).ready(function(){

  var api = "http://api.openweathermap.org/data/2.5/weather?lat=35&lon=139&appid=6d74d0390619e3ee3cfa85e3bc4ad80c&callback=?";

  $.getJSON(api, function(data){
    alert(data.coord.lon);
  });

});
Basically it's what @jdtdesigns said, it needs the "&callback=?" at the end of the url to behave with codepen
JD Tadlock
@jdtdesigns
@Nathandim Not for forismatic
they use 'jsonp=?' to return jsonp
Nathan
@Nathandim
oh so it depends from the api :worried:
JD Tadlock
@jdtdesigns
yep ;)
Nathan
@Nathandim
but the goal is to get jsonp instead of just json
JD Tadlock
@jdtdesigns
for codepen, sometimes you need it
Eric Chung
@chungeric
$(document).ready( function(){
  $.getJSON("http://api.forismatic.com/api/1.0/?method=getQuote&format=jsonp&jsonp=?", function(response){
    console.log(response.quoteText);
  });
});
not working, maybe i'm doing something wrong
JD Tadlock
@jdtdesigns
@chungeric
$(document).ready( function(){
  $.getJSON("http://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=jsonp&jsonp=?", function(json){
    console.log(json);
  });
});
works fine for me ;)
@chungeric post your codepen
Eric Chung
@chungeric
Lol even that doesn't work, ok hold on
JD Tadlock
@jdtdesigns
@chungeric Thought so. You're loading codepen over https. Remove https from the url and you're good to go. ;)
You can't load a page over secure https and then request data through http. It will throw a 'Mixed Content' error
Eric Chung
@chungeric
Oh wow, that's it?
Wait, would you happen to know why i'm on https?
JD Tadlock
@jdtdesigns
your browser will show the errors by the way in the console
ctrl shift js
Eric Chung
@chungeric
Yeah it was showing that error
JD Tadlock
@jdtdesigns
ctrl shift j
MrMacy
@MrMacy
Please help. I'm building my first portfolio page, and I'm can't seem to get any text to show belos my navigation bar. here's my code as is

<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"/>

<link href="https://fonts.googleapis.com/css?family=Pacifico" rel="stylesheet">

<style>
.orange-text {
color:#FF3D00!important;}
ul { background: #078; list-style-type: none;
margin: -4px;
padding: 0;
font-size: 25px;
border-color:#607D8B;

}
ul {position: fixed;
top: 5;
left:.4%;
right:.4%;
width: 100%;
}
h2 {display: inline-block;}
h2 {text-decoration: "none"; margin: -5px;}
h2 {font-family: 'Pacifico'; font-size: 40px;}
#navcontainer ul li { display: inline; }
#navcontainer ul li a { text-decoration: none; float: right; padding: 5px; margin: 5px; }


</style>

<nav class="container-fluid" id="navcontainer">

<ul class="form"> <h2 id="MrMacy"><li><a class="orange-text" href=#>MrMacy</a></li></h2><li><a class="orange-text" href=#>About</a></li><li><a class="orange-text" href=#>Portfolio</a></li><li><a class="orange-text" href=#>Contact</a></li><li><a class="orange-text" href=#>Links</a></li>
</ul></nav>

<div>


<p>aslkdjfasdfoj</p>

</div>