-
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
3 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
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,2 @@ | ||
.htaccess | ||
index.php |
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,97 @@ | ||
<!DOCTYPE html> | ||
<html lang="ca"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Prova Router</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script> | ||
<script src="js.js"></script> | ||
<style> | ||
.fakeimg { | ||
height: 200px; | ||
background: #aaa; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
|
||
<div class="p-5 bg-primary text-white text-center"> | ||
<h1>Proves de router</h1> | ||
<p>Proves de pàgina única amb fetch i server API amb php.</p> | ||
</div> | ||
|
||
<nav class="navbar navbar-expand-sm bg-dark navbar-dark"> | ||
<div class="container-fluid"> | ||
<ul class="navbar-nav"> | ||
<li class="nav-item"> | ||
<a class="nav-link active" href="#">Active</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="#">Link</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="#">Link</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link disabled" href="#">Disabled</a> | ||
</li> | ||
</ul> | ||
</div> | ||
</nav> | ||
|
||
<div class="container mt-5"> | ||
<div class="row"> | ||
<div class="col-sm-4"> | ||
<div class="p-3 bg-dark text-white"> | ||
<p> | ||
<input type="text" id="txt" placeholder="Escriu la request"> | ||
<button id="reqbtn" class="btn btn-primary" onclick="sendRequest()">Enviar</button> | ||
</p> | ||
<div id="resp" class="lead text-center">RESPONSE</div> | ||
</div> | ||
|
||
<h2>About Me</h2> | ||
<h5>Photo of me:</h5> | ||
<div class="fakeimg">Fake Image</div> | ||
<p>Some text about me in culpa qui officia deserunt mollit anim..</p> | ||
<h3 class="mt-4">Some Links</h3> | ||
<p>Lorem ipsum dolor sit ame.</p> | ||
<ul class="nav nav-pills flex-column"> | ||
<li class="nav-item"> | ||
<a class="nav-link active" href="#">Active</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="#">Link</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="#">Link</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link disabled" href="#">Disabled</a> | ||
</li> | ||
</ul> | ||
<hr class="d-sm-none"> | ||
</div> | ||
<div class="col-sm-8"> | ||
<h2>TITLE HEADING</h2> | ||
<h5>Title description, Dec 7, 2020</h5> | ||
<div class="fakeimg">Fake Image</div> | ||
<p>Some text..</p> | ||
<p>Sunt in culpa qui officia deserunt mollit anim id est laborum consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.</p> | ||
|
||
<h2 class="mt-5">TITLE HEADING</h2> | ||
<h5>Title description, Sep 2, 2020</h5> | ||
<div class="fakeimg">Fake Image</div> | ||
<p>Some text..</p> | ||
<p>Sunt in culpa qui officia deserunt mollit anim id est laborum consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.</p> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="mt-5 p-4 bg-dark text-white text-center"> | ||
<p>Footer</p> | ||
</div> | ||
|
||
</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,26 @@ | ||
'use strict'; | ||
|
||
function sendRequest() { | ||
|
||
let req = document.querySelector('#txt').value; | ||
let resp = document.querySelector('#resp'); | ||
resp.innerHTML = '<span class="spinner-grow spinner-grow-sm"></span> <span class="spinner-grow spinner-grow-sm"></span> <span class="spinner-grow spinner-grow-sm"></span> '; | ||
resp.innerHTML += '<span class="spinner-grow spinner-grow-sm"></span> <span class="spinner-grow spinner-grow-sm"></span> <span class="spinner-grow spinner-grow-sm"></span>'; | ||
|
||
if (req) { | ||
req = 'http://localhost/xavi-mat.github.io/' + req; | ||
let reqbtn = document.querySelector('#reqbtn'); | ||
reqbtn.disabled = true; | ||
reqbtn.innerHTML = '<span class="spinner-border spinner-border-sm"></span> Enviando...'; | ||
fetch(req) | ||
.then((resp)=>resp.json()) | ||
.then((data)=>{ | ||
resp.innerHTML = data.url; | ||
reqbtn.innerHTML = 'Enviar'; | ||
reqbtn.disabled = false; | ||
}); | ||
|
||
} else { | ||
resp.innerHTML = 'Please enter a URL'; | ||
} | ||
} |