-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
131 additions
and
56 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Document</title> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.min.css" /> | ||
<link rel="stylesheet" href="style.css" /> | ||
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
|
||
<div class="row justify-content-center"> | ||
|
||
<div class="col-md-8"> | ||
<h1 class="text-center mt-5">Bitcoin Price</h1> | ||
|
||
<div id="price" class="text-center"> | ||
<span id="price_label">xxxx.xx</span> € | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
||
</div> | ||
<script src="script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const url = 'https://blockchain.info/ticker'; | ||
|
||
async function recupererPrix() { | ||
axios.get(url) | ||
.then(function(donnees) { | ||
document.querySelector("#price_label").textContent = donnees.data.EUR.last; | ||
}) | ||
.catch(function(erreur) { | ||
alert('Un problème est survenu'); | ||
}) | ||
} | ||
|
||
setInterval(recupererPrix, 1000); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const url = 'https://lesoublisdelinfo.com/api.php'; | ||
|
||
const axiosInstance = axios.create({ | ||
headers: { | ||
'Content-Type': 'applicaiton/x-www-form-urlencoded' | ||
} | ||
}); | ||
|
||
axiosInstance.post(url, new URLSearchParams({ | ||
prenom: 'Steve' | ||
})) | ||
.then(function(donnees) { | ||
console.log(donnees); | ||
}) | ||
.catch(function(erreur) { | ||
console.log(erreur); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ <h1 class="text-center mt-5">Bitcoin Price</h1> | |
</div> | ||
|
||
</div> | ||
|
||
<script src="script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const url = 'https://blockchain.info/ticker'; | ||
|
||
async function recupererPrix() { | ||
const requete = await fetch(url, { | ||
method: 'GET' | ||
}); | ||
|
||
if (!requete.ok) { | ||
alert('Un problème est survenu'); | ||
} else { | ||
let donnees = await requete.json(); | ||
document.querySelector("#price_label").textContent = donnees.EUR.last; | ||
} | ||
} | ||
|
||
setInterval(recupererPrix, 1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
h1 { | ||
color: #272343; | ||
} | ||
|
||
#price { | ||
font-size: 4em; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const url = 'https://lesoublisdelinfo.com/api.php'; | ||
|
||
async function envoyerPrenom(prenom) { | ||
const requete = await fetch(url, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded' | ||
}, | ||
body: new URLSearchParams({ | ||
prenom | ||
}) | ||
}); | ||
|
||
if (!requete.ok) { | ||
alert('Un problème est survenu'); | ||
} else { | ||
const donnees = await requete.json(); | ||
console.log(donnees); | ||
} | ||
} | ||
|
||
envoyerPrenom('Teddy'); | ||
|
||
// let requete = new XMLHttpRequest(); | ||
|
||
// // Get | ||
// // requete.open('GET', url); | ||
// // requete.responseType = 'json'; | ||
// // requete.send(); | ||
|
||
// // Post | ||
// requete.open('POST', url); | ||
// requete.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); | ||
// requete.responseType = 'json'; | ||
// requete.send('prenom=John'); | ||
|
||
// requete.onload = function() { | ||
// if (requete.readyState === XMLHttpRequest.DONE) { | ||
// if (requete.status === 200) { | ||
// let reponse = requete.response; | ||
// console.log(reponse); | ||
// } | ||
// else { | ||
// alert('Un problème est intervenu, merci de revenir plus tard.'); | ||
// } | ||
// } | ||
// } |