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
Mikail Bayram
@mikail1998
@sjames1958gm thank you anyway
CamperBot
@camperbot
mikail1998 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 3732 | @sjames1958gm |http://www.freecodecamp.com/sjames1958gm
Stephen James
@sjames1958gm
@mikail1998 yw
vínαч puppαl
@vinaypuppal
@mikail1998 If you want to debug why your loop/code is not working you can place some debugger statements, setup some breakpoints and step through your code line by line and find whats missing . If you dont know how to debug code in chrome search in google you will find many videos and articles.
Pat Dayton
@daytonpe
Hi everyone. Working on the random quote machine. I've got it to where when I hit the button, the correct query of the https://quotesondesign.com/api-v4-0/ API pops up where the quote should. I need to figure out how to get the actual quote from that query string
Mikail Bayram
@mikail1998
@vinaypuppal well maybe its working but my logic is not
i dont see any errors or anything
vínαч puppαl
@vinaypuppal
@mikail1998 not errors i mean you can check why your logic is not working by pausing execution of each line and manually executing yourself step by step. Chrome Debugger allows you to do that so once see a video or an article about it you will understand what i mean.
Pat Dayton
@daytonpe
    <script>
        $(document).ready(function() {
            var html = "http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1";
            $("#getMessage").on("click", function(){
      // Only change code below this line.

      // $(".message").html("Here is the message");// Only change code above this line.
            $(".message").html(html);

        });
        });
    </script>
vínαч puppαl
@vinaypuppal
@daytonpe are you working locally or on codepen ?? And you need to make AJAX call with that URL , you can find an example here https://quotesondesign.com/api-v4-0/ about how to use $.getJSON().
Mikail Bayram
@mikail1998
@vinaypuppal oh okay thank you
CamperBot
@camperbot
mikail1998 sends brownie points to @vinaypuppal :sparkles: :thumbsup: :sparkles:
:cookie: 600 | @vinaypuppal |http://www.freecodecamp.com/vinaypuppal
vínαч puppαl
@vinaypuppal
@daytonpe If you working on codepen move your JavaScript (without script tags)to JS Panel of your codepen . And if your new to codepen read this article to learn how to codepen https://medium.freecodecamp.com/codepen-tips-and-best-practice-cf926ebd0b11
Pat Dayton
@daytonpe
@vinaypuppal Thanks for help:) I'm working locally, and i've been looking at that site, but am still confused about what's going on with the AJAX call.
CamperBot
@camperbot
daytonpe sends brownie points to @vinaypuppal :sparkles: :thumbsup: :sparkles:
:cookie: 601 | @vinaypuppal |http://www.freecodecamp.com/vinaypuppal
Pat Dayton
@daytonpe
@vinaypuppal I should be changing the line that talks about body to my html bit?
vínαч puppαl
@vinaypuppal

@daytonpe sorry i did not understand your above question
but you need to make a call to API to get quotes like

$.getJSON("http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&callback=", function(response) {
  console.log(response);
});

After executing above line you will see a response in chrome/browser console.

function(response) {
  console.log(response);
}

The above part is called callback we are telling $.getJSON to call this callback function after it receives a response from API as AJAX calls are Asynchronous i.e may take a while to complete

Pat Dayton
@daytonpe
@vinaypuppal ohhhh. okay cool! thank you. I'll play around with it
CamperBot
@camperbot
daytonpe sends brownie points to @vinaypuppal :sparkles: :thumbsup: :sparkles:
:warning: daytonpe already gave vinaypuppal points
vínαч puppαl
@vinaypuppal

@daytonpe more precisely like this

$("#getMessage").on("click", function(){
      // Only change code below this line.

      // $(".message").html("Here is the message");// Only change code above this line.
$.getJSON("http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&callback=", function(response) {
     console.log(response);
    $(".message").html(response[0].content);
});
 });

response is an Array so you can access your quote like response[0].content you will get idea how to access required data from response once you see the console.log of response
and if you want to learn more about AJAX follow this course https://www.udacity.com/course/intro-to-ajax--ud110

Pat Dayton
@daytonpe

@vinaypuppal When i put this in, I get: XMLHttpRequest cannot load http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&callback=. The 'Access-Control-Allow-Origin' header has a value 'http://null' that is not equal to the supplied origin. Origin 'null' is therefore not allowed access.

Googled it and it got pretty complicated very quickly.

vínαч puppαl
@vinaypuppal
@daytonpe don't know how your opening your html file in browser but it works here http://jsbin.com/jipaqu/1/edit?html,js,console,output
Pat Dayton
@daytonpe
@vinaypuppal I'm opening it in chrome. The files are hosted locally on my computer.
<!DOCTYPE html>

<html>

<head>
    <title>Random Quote Generator</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
    <link rel="stylesheet" href="stylesheet.css" type="text/css" />
</head>

<body>

    <script>
        $(document).ready(function() {
            $("#getMessage").on("click", function(){
                $.getJSON("http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&callback=", function(response) {
                     console.log(response);
                    $(".message").html(response[0].content);
                });
             });
        });
    </script>

    <div class="container-fluid">
        <div class = "row text-center">
            <h2>Random Quote Generator</h2>
        </div>
        <div class = "row text-center">
            <div class = "col-xs-12 well message">
                The message will go here
            </div>
        </div>
        <div class = "row text-center">
            <div class = "col-xs-12">
                <button id = "getMessage" class = "btn btn-primary">
                    Get Message
                </button>
            </div>
        </div>

</body>

</html>
Pat Dayton
@daytonpe
and i'm trying to use the one you sent me in JS bin, and i'm not seeing anything pop up in console when i hit the button. Not sure what's going on :/
thanks again for helping me out
vínαч puppαl
@vinaypuppal
@daytonpe yeah getting same error null if i open your code locally in my browser. Still finding what's happening
vínαч puppαl
@vinaypuppal
@daytonpe okay i found it you need to add ? after callback= in AJAX URL and need to run a local server since CORS does not work over normal file opening in browser as i read in this. http://stackoverflow.com/questions/3595515/xmlhttprequest-error-origin-null-is-not-allowed-by-access-control-allow-origin
spark72018
@spark72018
hey everyone, i'm on the twitchTV zipline and can't get past the iframe sandbox issue, does anyone know how i can get the twitch page to load after someone clicks on the link?
vínαч puppαl
@vinaypuppal
@daytonpe Which editor are you using , if Atom/Brcakets/Sublime they have some plugins to run your files with local server easily .
Stephen James
@sjames1958gm
@spark72018 target="_blank" in your link
spark72018
@spark72018
hm iv'e set the href value to target="_blank" in the <a> tag but all it does is open a new tab, then load the background but stops there. the stream itself doens't load
Homero
@homerrowsky
@daytonpe have you tried jsonp? (page Quote on design mention to use it for passing the "cross origin thing"
vínαч puppαl
@vinaypuppal
@spark72018 Yes saw same behaviour in chrome browser previously its TwitchTV issue as you can see bunch of errors in console
@homerrowsky yeah the callback= in URL makes it JSONP call but he is opening html file directly in browser so CORS is not working
@homerrowsky he needs to run a localserver then it will work
Pat Dayton
@daytonpe
@vinaypuppal Thanks man. I' using Sublime
CamperBot
@camperbot
daytonpe sends brownie points to @vinaypuppal :sparkles: :thumbsup: :sparkles:
:warning: daytonpe already gave vinaypuppal points
Pat Dayton
@daytonpe
thanks @homerrowsky
CamperBot
@camperbot
daytonpe sends brownie points to @homerrowsky :sparkles: :thumbsup: :sparkles:
:cookie: 277 | @homerrowsky |http://www.freecodecamp.com/homerrowsky
Jeremy Barbe
@eemebarbe
hey with .map(), how do you get the index value?
spark72018
@spark72018
yeah i saw the errors but was hoping there is a way around this issue T_T, i guess i'll just table this project for now
vínαч puppαl
@vinaypuppal
@spark72018 check in Firefox it will work
@eemebarbe second argument to map is index
Pat Dayton
@daytonpe
@vinaypuppal I added that ? and now i'm getting: Refused to execute script from 'http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_p…_page]=1&callback=jQuery18305606229390975579_1475867186116&_=1475867189607' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.