+ Domů
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/20_ajax/todofetch.html b/20_ajax/todofetch.html
new file mode 100644
index 0000000..fcf01cc
--- /dev/null
+++ b/20_ajax/todofetch.html
@@ -0,0 +1,19 @@
+
+
+
+
+
+ Práce s API
+
+
+
Práce s API serverem
+ Domů
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/20_ajax/todoscript.js b/20_ajax/todoscript.js
new file mode 100644
index 0000000..eb93f78
--- /dev/null
+++ b/20_ajax/todoscript.js
@@ -0,0 +1,27 @@
+document.getElementById("fetchTodo").addEventListener("click",function(){
+ const todoId = document.getElementById("todoId").value;
+ var todoResult = document.getElementById("todoResult");
+ todoResult.innerHTML = "Načítám..."
+
+ let url = "https://jsonplaceholder.typicode.com/todos/";
+ if (todoId !== "" && todoId > 0) { url += todoId; }
+ console.log(url)
+
+ fetch(url).then(response => response.json())
+ .then(data => {
+ if(data) {
+ todoResult.innerHTML = `