diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c3d24e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.htaccess +index.php diff --git a/index.html b/index.html new file mode 100644 index 0000000..143437c --- /dev/null +++ b/index.html @@ -0,0 +1,97 @@ + + + + + Prova Router + + + + + + + + +
+

Proves de router

+

Proves de pàgina única amb fetch i server API amb php.

+
+ + + +
+
+
+
+

+   + +

+
RESPONSE
+
+ +

About Me

+
Photo of me:
+
Fake Image
+

Some text about me in culpa qui officia deserunt mollit anim..

+

Some Links

+

Lorem ipsum dolor sit ame.

+ +
+
+
+

TITLE HEADING

+
Title description, Dec 7, 2020
+
Fake Image
+

Some text..

+

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.

+ +

TITLE HEADING

+
Title description, Sep 2, 2020
+
Fake Image
+

Some text..

+

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.

+
+
+
+ +
+

Footer

+
+ + + \ No newline at end of file diff --git a/js.js b/js.js new file mode 100644 index 0000000..2031f45 --- /dev/null +++ b/js.js @@ -0,0 +1,26 @@ +'use strict'; + +function sendRequest() { + + let req = document.querySelector('#txt').value; + let resp = document.querySelector('#resp'); + resp.innerHTML = ' '; + resp.innerHTML += ' '; + + if (req) { + req = 'http://localhost/xavi-mat.github.io/' + req; + let reqbtn = document.querySelector('#reqbtn'); + reqbtn.disabled = true; + reqbtn.innerHTML = ' 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'; + } +} \ No newline at end of file