Skip to content

Instantly share code, notes, and snippets.

Created June 13, 2016 10:23
Show Gist options
  • Select an option

  • Save anonymous/59c170dc33321c459e3aec8d7644a620 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/59c170dc33321c459e3aec8d7644a620 to your computer and use it in GitHub Desktop.
JSON , quotes
<div id="b" class="quotes">
цитата
</div>
<div id="c" class="author">
автор
</div>
<button id="a">new quote</button>
$("#a").click(function() {
$.getJSON("http://api.forismatic.com/api/1.0/?method=getQuote&lang=ru&format=jsonp&jsonp=?", function(z) {
$("#b").html(JSON.stringify(z["quoteText"]));
$("#c").html(JSON.stringify(z["quoteAuthor"]));
});
});
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
body {
background-image: url(http://cdn.fishki.net/upload/post/201406/20/1278835/w6kdytk7-js.jpg);
background-size: 100%;
height: 0 auto;
}
.quotes {
margin: 20% 20% 0% 20%;
color: white;
font-size: 2em;
width: 60%;
height: 20%;
background-color: rgba(255, 255, 255, 0.1);
text-align: center;
}
.author {
margin: 1% 20% 0% 20%;
color: white;
font-size: 2em;
width: 60%;
height: 20%;
background-color: rgba(255, 255, 255, 0.1);
text-align: center;
}
button {
margin: 1% 44% 0% 44%;
width: 12%;
background-color: #393E46;
position: relative;
font-size: 1.5em;
text-decoration: none;
color: #fff;
border-radius: 5px;
background-color: rgba(255, 255, 255, 0.1);
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.1/animate.min.css" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment