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
leomartin
@abhirupleo
this might help @Netrunner21
its okay @jtan3
Netrunner21
@Netrunner21
It also had HTML styling such as &8221; that needed filtering, but that has nothing to do with text() or html()
leomartin
@abhirupleo
yes
Netrunner21
@Netrunner21
@abhirupleo Thats the one I saw about ten minutes ago and prompted the question. I figured why not pass the tags through with HTML where text() sets everything to plain text. I got what you were saying though.
leomartin
@abhirupleo
+1:
kirbyedy
@kirbyedy
@abhirupleo dunno about your code
but this one is a working example
$(document).ready(function() {


  $.ajax({
    url: 'https://andruxnet-random-famous-quotes.p.mashape.com/cat=', // The URL to the API. You can get this by clicking on "Show CURL example" from an API profile
    type: 'GET', // The HTTP Method
    data: {}, // Additional parameters here
    datatype: 'json',
    success: function(data) { alert(JSON.stringify(data)); },
    error: function(err) { alert(err); },
    beforeSend: function(xhr) {
    xhr.setRequestHeader("X-Mashape-Authorization", "HL5Yr3E9RZmshc7CyNeA0JrwnjD7p1H6dKVjsnDjlYdeqTgBW9"); // Enter here your Mashape key
    }
});


});
Netrunner21
@Netrunner21
question #2 ... $.ajax versus $getJSON
kirbyedy
@kirbyedy
I think you have more control over ajax
Netrunner21
@Netrunner21
more options I guess
looks prettier lol
Johnny
@jtan3
https://codepen.io/jtan3/pen/ZKMRdW?editors=0010 How can I get my "session time" to count by 1. When I put my session*=60 outside my click function and it breaks my "session time" control.
Netrunner21
@Netrunner21
Made some changes to my Wiki Viewer. What do you guys think?
Johnny
@jtan3
@Netrunner21 I like the hover effects !
Netrunner21
@Netrunner21
Thanks. I has taken some time to get everything looking right
It *
mboesiger90
@mboesiger90

So I have this working now but some of the quotes are too long from this API. Is there someway I can add a string.length filter to the filter that goes with the URL or do I have to completely reorder my coding

$(document).ready(function(){
$.ajax({
cache: false,
url: 'https://quotesondesign.com/wp-json/posts?filter[orderby]=rand',
success:function(data){
var post = data.shift();
$(".quote").html(post.content);
$(".author").html("-" + post.title);
}
});
$("#getQuote").on('click', function (e){
e.preventDefault;
$.ajax({
cache: false,
url: 'https://quotesondesign.com/wp-json/posts?filter[orderby]=rand',
success:function(data){
var post = data.shift();
$(".quote").html(post.content);
$(".author").html("-" + post.title);
}
});
});
});
$("#tweet").click(function(){
var tweetQuote = $(".quote").text() + "-" + $(".author").text();
var tweetLink = 'https://twitter.com/intent/tweet?text=' + encodeURIComponent(tweetQuote);
window.open(tweetLink, '_blank')
});

Netrunner21
@Netrunner21
@mboesiger90 Your code only has to send the tweet to twitter. It's ok if it's too long. Interesting though if you truly did want to filter the quotes you could absoluly use a string.length type condition
I used the same API. You could test the length, and if it's too long have your code grab another random link.
mboesiger90
@mboesiger90
yeah I tried that in the filter that I have within my url but that doesnt seem to work
Netrunner21
@Netrunner21
random quote, sorry
mboesiger90
@mboesiger90
oh or you mean make an if statement?
Netrunner21
@Netrunner21
yeah, so basically it checks the length and if it's too long it doesn't get passed on, it reruns the code and grabs another quote.
That API has a lot of long ones though
mboesiger90
@mboesiger90
ok that would work
This API has too many quotes that are too long and then they mess up my layout haha
Pranav Reddy
@ne0ng0d
Guys how do I start working on the portfolio?
Netrunner21
@Netrunner21
I understand, otherwise its a decent API
mboesiger90
@mboesiger90
google ideas and templates to get an idea
Netrunner21
@Netrunner21
@ne0ng0d make a new pen, and add the stuff you want like bootstrap, animate.css, font awesome, jquery, etc.
That's my process of getting started
Honestly though I skipped that one. I'm going to do it when I finish all my projects. The portfolio is layout heavy and I'm not very good at design, hah.
Pranav Reddy
@ne0ng0d
Thanks @Netrunner21
CamperBot
@camperbot
ne0ng0d sends brownie points to @netrunner21 :sparkles: :thumbsup: :sparkles:
:cookie: 327 | @netrunner21 |http://www.freecodecamp.com/netrunner21
Netrunner21
@Netrunner21
@ne0ng0d You're welcome
mboesiger90
@mboesiger90
haha I had so much trouble picking a color scheme for my portfolio and now I hate it anyway so I will definitely be going back to redesign it with my newfound knowledge
Pranav Reddy
@ne0ng0d
but how do I do things like the buttons doing different function adding a menu bar and adding multiple pictures next to each other and adding icons to different websites
Saeed Jassani
@saeedjassani
hello, i need help in "Random Quote Machine" project
how can i change the backgrount color of my bootstrap button?
mboesiger90
@mboesiger90
make a class, assign the class to the button, and change the background-color in the class
Netrunner21
@Netrunner21
@ne0ng0d there are several ways. You can add onclick="function()" to make buttons do things.
Saeed Jassani
@saeedjassani
@mboesiger90 i tried color: white !important;
to btn-default class of bootstrap
Netrunner21
@Netrunner21
@ne0ng0d bootstrap has sample menus that you can copy/paste
Saeed Jassani
@saeedjassani
but the ripple effect goes away
kirbyedy
@kirbyedy
@saeedjassani you have to target the button in css