forked from Priyanshu85/Webtools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
49 lines (41 loc) · 1.2 KB
/
script.js
File metadata and controls
49 lines (41 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// $(function() {
// var quote = $('#quote-text');
// getQuote(quote);
//
// // $('#getQuote').click(function(event) {
// window.onload(function(event) {
// event.preventDefault();
// getQuote(quote);
// })
// });
// function getQuote(quote) {
// // let quote=document.getElementById('quote-text');
// // quote.innerText=;
// var url = "https://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=jsonp&jsonp=?"
// $.getJSON(url, function(data) {
// quote.html(data.quoteText);
// });
// }
// getQuote();
// var url = "https://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=jsonp&jsonp=?";
// fetch(url).then((response)=>{
// console.log("fads");
// return response.json();
// }).then((data)=>{
// console.log("this is something else than fads");
// console.log(data);
// })
$(function() {
var quote = $('#quote-text');
getQuote(quote);
$('#getQuote').click(function(event) {
event.preventDefault();
getQuote(quote);
})
});
function getQuote(quote) {
var url = "https://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=jsonp&jsonp=?"
$.getJSON(url, function(data) {
quote.html(data.quoteText);
});
}