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
@chiphip The one on jsbin? lol
chiphip
@chiphip
no....the one codepen, the green one
JD Tadlock
@jdtdesigns
ah, thanks :) @chiphip
CamperBot
@camperbot
:cookie: 265 | @chiphip |http://www.freecodecamp.com/chiphip
jdtdesigns sends brownie points to @chiphip :sparkles: :thumbsup: :sparkles:
Icah Banton
@remdata
@jdtdesigns . With the quotes I get the following error: alertTest.html:9 Uncaught SyntaxError: Unexpected token }
chiphip
@chiphip
How long did you work on that project?
JD Tadlock
@jdtdesigns
hmm, probably 2 hours or so
@remdata Post your pen
Patrick Black
@Mortiferr
http://codepen.io/Mortiferr/pen/oBZJzp?editors=1010
My document.write for the celcius and Fahrenheit isn't appearing
Icah Banton
@remdata

@jdtdesigns . It's not a pen but here is the code: <html>

<head>

<title>Event Test</title>
</head>

<body>

<h1>Event Test</h1>
<p>
<button onClick="alert("Aha! An Event!")">Click this to test an event handler</button>
</p>
</body>
</html>

Patrick Black
@Mortiferr
I added an if statement to make sure it wouldn't print until its ready but the function still isn;t calling correctly
Eric Chung
@chungeric
Hi guys, I'm trying to build the random quote generator using an external API, but i'm having trouble getting the data
$(document).ready( function(){
  $.getJSON("http://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en", function(json){
    $(".quote").html(json.quoteText);
  });
});
This is what i've got for the javascript, and I have a div with class quote but it's not changing. Any help? Thanks!
sennator
@sennator2
@chungeric i would suggest that you first take a look at this video https://www.youtube.com/watch?v=5xeDQ1-ZfcQ
calit nicely explains how you call api and how to manipulate data you get
you are going to need that in chalenges to come
Kantra
@removed~kantrakantra

Hey guys, can anybody help me figure out why this code is working in jsfiddle but not in codepen.

I figure since it's the exact same code it should work just fine. I added jquery and bootstrap to the codepen code.

here's the jsfiddle: http://jsfiddle.net/Kantra/qz0x4rLw/1/

here's the codepen: http://codepen.io/kantrakantra/pen/qRXJRV

Darth Skywalker
@adityaparab

@chungeric try changing your url from

http://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en

to

http://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en&callback=?
added &callback=? at the end of the url as this is cross domain request and you will need jsonp
Eric Chung
@chungeric
Didn't work, thanks though. I'm just watching the video sent above
Nathan
@Nathandim
I feel you. I'm in the next project and I'm struggling to make openweathermap API behave on codepen
JD Tadlock
@jdtdesigns
@remdata Just had a look at it. First, there's no good reason to use vanilla js to do ajax. It's clunky and requires a lot of code to clean the response. You'll continually get errors until you have a page of code just for a simple ajax request. Second, you have script in the html which has no connection to your js in the JS panel. Delete the html script and that'll remove one error.
Third codepen is picky with what data can be requested, so just understand you'll prob get errors no matter what you do, when using vanilla for ajax.
Eric Chung
@chungeric
Haha yeah I've been putting this off for a while, cause I didn't want to hard code the quotes but didn't know how not to. jsonp I see. I'll have a look into it :) Thanks for the info guys
JD Tadlock
@jdtdesigns
@chungeric If you look at Forismatic's api documentation page, you'll see this 'jsonp=<string> — callback function name, used for jsonp format only (usage example)'
every api that supports jsonp has a way of telling the api to send jsonp instead of json
the typical convention is callback=?
but for forismatic they decided to go with jsonp=?
Eric Chung
@chungeric
Hm okay, but the data doesn't differ in any way? Between json and jsonp
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