Repository: markbozsoki/GAMF_webprog_1_ea
Pull request #8: 5 os feladat ajax
Author: login: MoSzabina
Created: 2025-03-18T18:07:45Z | Merged: 2025-03-27T16:21:57Z

# Description
<!-- Please summarize what has been changed/added/removed -->
AJAX alkalmazást az API-t felhasználva, weboldalhoz illeszkedő felülettel. Create, update, delete funkciók megvalósítása. Height adatokból összeg, átlag, legnagyobb számítása. 


# Screenshots
![Képernyőkép_23-3-2025_202832_](https://github.com/user-attachments/assets/6b77d152-5c1f-4292-b0e5-5e4a92acc78f)




# Checks
<!-- Please check this only if it's true -->
- [x] I tested and verified the changes made.



Diff:
diff --git a/index.html b/index.html
index 6884c52..fb1363a 100644
--- a/index.html
+++ b/index.html
@@ -19,8 +19,8 @@ <h1 class="header">Web-programozás-1 Előadás Házi feladat</h1>
                     <li><a href="index.html" class="active">Főoldal</a></li>
                     <li><a href="resources/2/tablazat.html">Táblázat</a></li>
                     <li><a href="html5.html">HTML5</a></li>
-                    <li><a href="chartjs.html">ChartJS</a></li>
-                    <li><a href="ajax.html">AJAX</a></li>
+                    <li><a href="resources/4/chartjs.html">ChartJS</a></li>
+                    <li><a href="resources/5/ajax.html">AJAX</a></li>
                     <li><a href="oojs.html">OOJS</a></li>
                 </ul>
             </nav>
diff --git a/resources/5/ajax.html b/resources/5/ajax.html
new file mode 100644
index 0000000..e2628b3
--- /dev/null
+++ b/resources/5/ajax.html
@@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html lang="hu">
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Web-programozás-1 Előadás Házi feladat - AJAX</title>
+    <link type="text/css" rel="stylesheet" href="../main.css">
+    <link type="text/css" rel="stylesheet" href="style.css">
+</head>
+
+<body>
+    <div id="pageContainer">
+        <div id="contentWrap">
+            <header>
+                <h1 class="header">Web-programozás-1 Előadás Házi feladat</h1>
+            </header>
+            <nav>
+                <ul>
+                    <li><a href="../../index.html">Főoldal</a></li>
+                    <li><a href="../2/tablazat.html">Táblázat</a></li>
+                    <li><a href="../3/html5.html">HTML5</a></li>
+                    <li><a href="../4/chartjs.html">ChartJS</a></li>
+                    <li><a href="ajax.html" class="active">AJAX</a></li>
+                    <li><a href="../6/oojs.html">OOJS</a></li>
+                </ul>
+            </nav>
+            <aside>
+                <h1>AJAX alkalmazás</h1>
+                <hr>
+                <h2>Az 5. feladat megvalósítása</h2>
+            </aside>
+            <section>
+                <article>
+                <h1>AJAX alkalmazás</h1>
+                </article>
+                <div class="container">
+                    <div class="box">
+                        <p id="code">code= VE22CSabc123</p>
+                        <h3>Adatok lekérése</h3>
+                        <button id="readBtn">Adatok lekérése</button>
+                        <div id="readDiv"></div>
+                    </div>
+                    <div class="box">
+                        <h3>Magasság Statisztika</h3>
+                        <p>Összeg: <span id="sumHeight">-</span></p>
+                        <p>Átlag: <span id="avgHeight">-</span></p>
+                        <p>Legnagyobb: <span id="maxHeight">-</span></p>
+                    </div>
+                    <div class="box">
+                        <h3>Új adat létrehozása</h3>
+                        Név (kötelező, max 30):<br><input id="name1" type="text"></input><br>
+                        Magasság (cm) (kötelező, max 30): <input id="height1" type="text"></input><br>
+                        Súly (kg) (kötelező, max 30): <input id="weight1" type="text"></input><br>
+                        <button type="submit" onclick="create();">Létrehoz</button><br>
+                        <div id="createDiv"></div>
+                        <div id='createResult'></div>
+                    </div>
+                    <div class="box">
+                        <h3>Adatok frissítése</h3>
+                        ID (kötelező): <input id="idUpd" type="text"></input><br>
+                        <button type="submit" onclick="getDataForId();">ID adat lekérése</button><br>
+                        Név (kötelező, max 30):<br><input id="name2" type="text"></input><br>
+                        Magasság (kötelező, max 30):<br><input id="height2" type="text"></input><br>
+                        Súly (kötelező, max 30):<br><input id="weight2" type="text"></input><br>
+                        <button type="submit" onclick="update();">Frissítés</button><br>
+                        <div id='updateResult'></div>
+                    </div>
+                    <div class="box">
+                        <h3>Adat törlése</h3>
+                        ID (kötelező): <input id="idDel" type="text"></input><br>
+                        <button type="submit" onclick="deleteF();">Törlés</button><br>
+                        <p id="deleteResult"></p>
+                    </div>
+                </div>
+            </section>
+            <footer><label>Óré Szabina Vivien VE22CS & Bozsóki Márk I6SUE5</label></footer>
+        </div>
+    </div>
+    <script type="text/javascript" src="ajax.js"></script>
+</body>
+
+</html>
diff --git a/resources/5/ajax.js b/resources/5/ajax.js
new file mode 100644
index 0000000..f54a1d2
--- /dev/null
+++ b/resources/5/ajax.js
@@ -0,0 +1,225 @@
+const url = "http://gamf.nhely.hu/ajax2/";
+const code = "VE22CSabc123";
+document.getElementById("code").innerHTML = "code=" + code;
+
+async function read() {
+  try {
+    let response = await fetch(url, {
+      method: 'post',
+      cache: 'no-cache',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+      body: "code=" + code + "&op=read"
+    });
+    let data = await response.text();
+    try {
+      data = JSON.parse(data);
+    } catch (jsonError) {
+      console.error("Hiba: A válasz nem JSON formátumú!", data);
+      return;
+    }
+
+    let list = data.list;
+    let sum = 0;
+    let max = 0;
+
+    let str = "";
+    str += "<p>Rekordok száma: " + data.rowCount + "</p>";
+    str += "<p>Utolsó max " + data.maxNum + " rekord:</p>";
+    str += "<table><tr><th>id</th><th>Név</th><th>Magasság</th><th>Súly</th><th>code</th></tr>";
+
+    for (let i = 0; i < list.length; i++) {
+      let height = parseFloat(list[i].height);
+      if (!isNaN(height)) {
+        sum += height;
+        if (height > max) {
+          max = height;
+        }
+      }
+      str += `<tr>
+              <td>${list[i].id}</td>
+              <td>${list[i].name}</td>
+              <td>${list[i].height}</td>
+              <td>${list[i].weight}</td>
+              <td>${list[i].code}</td>
+          </tr>`;
+    }
+    str += "</table>";
+
+    let readDiv = document.getElementById("readDiv");
+    if (readDiv) {
+      readDiv.innerHTML = str;
+    }
+    else {
+      console.error("Hiba: readDiv nem található az oldalon!");
+    }
+
+    let count = list.length;
+    let avg = count > 0 ? (sum / count).toFixed(2) : 0;
+
+    document.getElementById("sumHeight").innerText = sum;
+    document.getElementById("avgHeight").innerText = avg;
+    document.getElementById("maxHeight").innerText = max;
+
+  } catch (error) {
+    console.error("Hiba az API hívás során:", error);
+  }
+}
+
+async function create() {
+  let nameStr = document.getElementById("name1").value;
+  if (nameStr == "" || nameStr.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás név!";
+    return;
+  }
+
+  let height = document.getElementById("height1").value;
+  if (height == "" || height.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás magasság!";
+    return;
+  }
+
+  let weight = document.getElementById("weight1").value;
+  if (weight == "" || weight.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás súly!";
+    return;
+  }
+
+  let response = await fetch(url, {
+    method: 'post',
+    cache: 'no-cache',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    body: "code=" + code + "&op=create&name=" + nameStr + "&height=" + height + "&weight=" + weight
+  });
+
+  let data = await response.text();
+  if (data > 0) {
+    str = "Sikeresen létrehozva";
+  }
+  else {
+    str = "Létrehozás sikertelen!";
+    return;
+  }
+
+  document.getElementById("createResult").innerHTML = str;
+  document.getElementById("name1").value = "";
+  document.getElementById("height1").value = "";
+  document.getElementById("weight1").value = "";
+  read();
+}
+
+async function getDataForId() {
+  let id = document.getElementById("idUpd").value;
+  if (id == "") {  //filter needless API calls
+    return;
+  }
+
+  let response = await fetch(url, {
+    method: 'post',
+    cache: 'no-cache',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    body: "code=" + code + "&op=read"
+  });
+
+  let data = await response.text();
+  let parsed_data = null;
+  try {
+    parsed_data = JSON.parse(data);
+  } catch (jsonError) {
+    console.error("Hiba: A válasz nem JSON formátumú!", data);
+    return;
+  }
+  for (let i = 0; i < parsed_data.list.length; i++)
+    if (parsed_data.list[i].id == id) {
+      document.getElementById("name2").value = parsed_data.list[i].name;
+      document.getElementById("height2").value = parsed_data.list[i].height;
+      document.getElementById("weight2").value = parsed_data.list[i].weight;
+    }
+}
+
+async function update() {
+  id = document.getElementById("idUpd").value;
+  if (id == "") {
+    document.getElementById("updateResult").innerHTML = "ID megadása kötelező!";
+    return;
+  }
+
+  let nameStr = document.getElementById("name2").value;
+  if (nameStr == "" || nameStr.length > 30) {
+    document.getElementById("updateResult").innerHTML = "Hibás név!";
+    return;
+  }
+
+  let height = document.getElementById("height2").value;
+  if (height == "" || height.length > 30) {
+    document.getElementById("updateResult").innerHTML = "Hibás magasság!";
+    return;
+  }
+
+  let weight = document.getElementById("weight2").value;
+  if (weight == "" || weight.length > 30) {
+    document.getElementById("updateResult").innerHTML = "Hibás súly!";
+    return;
+  }
+
+  let response = await fetch(url, {
+    method: 'post',
+    cache: 'no-cache',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    body:
+      "code=" + code + "&op=update&id=" + id + "&name=" + nameStr + "&height=" + height + "&weight=" + weight
+  });
+
+  let data = await response.text();
+  if (data > 0) {
+    str = "Frissítés sikeres";
+  }
+  else {
+    str = "Frissítés sikertelen";
+    return;
+  }
+
+  document.getElementById("updateResult").innerHTML = str;
+  document.getElementById("idUpd").value = "";
+  document.getElementById("name2").value = "";
+  document.getElementById("height2").value = "";
+  document.getElementById("weight2").value = "";
+  read();
+}
+
+async function deleteF() {
+  id = document.getElementById("idDel").value;
+  if (id.length > 0 && id.length <= 30) {
+    let response = await fetch(url, {
+      method: 'post',
+      cache: 'no-cache',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+      body: "code=" + code + "&op=delete&id=" + id
+    });
+    let data = await response.text();
+    if (data > 0) {
+      str = "Törlés sikeres";
+    }
+    else {
+      str = "Törlés sikertelen!";
+    }
+    document.getElementById("deleteResult").innerHTML = str;
+    document.getElementById("idDel").value = "";
+    read();
+  }
+  else
+    document.getElementById("deleteResult").innerHTML = "Validation error!!";
+}
+
+window.onload = function () {
+  read();
+}; 
diff --git a/resources/5/style.css b/resources/5/style.css
new file mode 100644
index 0000000..67ef2f4
--- /dev/null
+++ b/resources/5/style.css
@@ -0,0 +1,32 @@
+.container {
+    display: flex;
+    flex-wrap: wrap;
+    justify-content: center;
+    gap: 5px; 
+}
+.box {
+    border: 2px solid #4CAF50; 
+    padding: 15px;
+    border-radius: 8px;
+    background-color: #f9f9f9;
+    width: 100%;
+    max-width: 400px; 
+    text-align: left;
+    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.1);
+}
+table {
+    border-collapse: collapse;
+    width: 100%;
+}
+
+th, td {
+    border: 1px solid black;
+    padding: 5px;
+    text-align: left;
+}
+@media (min-width: 768px) {
+    .container {
+        flex-direction: row;
+        justify-content: space-around;
+    }
+}


Reviews:
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T15:21:45Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T17:03:30Z
user: login: MoSzabina
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-23T19:27:07Z
user: login: MoSzabina
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-23T20:15:35Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T20:45:23Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T20:46:03Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T20:47:49Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T20:48:42Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T20:49:05Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T20:49:25Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T20:50:25Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T20:50:46Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T20:51:11Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T20:51:46Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T20:53:49Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T20:54:51Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T20:55:25Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T20:56:53Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T20:57:00Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T20:58:17Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T20:58:59Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T20:59:03Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T21:00:02Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T21:00:29Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T21:01:05Z
user: login: markbozsoki
state: COMMENTED
author_association: OWNER
submitted_at: 2025-03-23T21:03:32Z
user: login: MoSzabina
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-24T09:21:39Z
user: login: markbozsoki
state: APPROVED
author_association: OWNER
submitted_at: 2025-03-27T16:21:13Z

Review comments:
diff_hunk: @@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<html lang="hu">
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Web-programozás-1 Előadás Házi feladat - AJAX</title>
+    <link type="text/css" rel="stylesheet" href="../main.css">
+    <link rel="stylesheet" href="style.css">
+</head>
+
+<body>
+    <div id="pageContainer">
+        <div id="contentWrap">
+            <header>
+                <h1 class="header">Web-programozás-1 Előadás Házi feladat</h1>
+            </header>
+            <nav>
+                <ul>
+                    <li><a href="../../index.html">Főoldal</a></li>
+                    <li><a href="../2/tablazat.html">Táblázat</a></li>
+                    <li><a href="../3/html5.html">HTML5</a></li>
+                    <li><a href="../4/chartjs.html">ChartJS</a></li>
+                    <li><a href="ajax.html" class="active">AJAX</a></li>
+                    <li><a href="../oojs.html">OOJS</a></li>
+                </ul>
+            </nav>
+            <aside>
+                <h1>AJAX alkalmazás</h1>
+                <hr>
+                <h2>Az 5. feladat megvalósítása</h2>
+            </aside>
+            <section>
+                <h1>AJAX alkalmazás</h1>
+                <div class="container">
+                    <div class="box">
+                        <p id="code">code= VE22CSabc123</p>
+                        <h3>Adatok lekérése</h3>
+                        <button id="readBtn">Adatok lekérése</button>
+                        <div id="readDiv"></div>
+                    </div>
+                    <div class="box">
+                        <h3>Height (Magasság) Statisztika</h3>
+                        <p>Összeg: <span id="sumHeight">-</span></p>
+                        <p>Átlag: <span id="avgHeight">-</span></p>
+                        <p>Legnagyobb: <span id="maxHeight">-</span></p>
+                    </div>
+                    <div class="box">
+                        <h3>Új adat létrehozása</h3>
+                        Név (kötelező, max 30): <input id="name1" type="text"></input><br>
+                        Height (kötelező, max 30): <input id="height1" type="text"></input><br>
+                        Weight (kötelező, max 30): <input id="weight1" type="text"></input><br>
+                        <button type="submit" onclick="create();">Create</button><br>
+                        <div id="createDiv"></div>
+                        <div id='createResult'></div>
+                    </div>
+                    <div class="box">
+                        <h3>Update</h3>
+                        ID (kötelező): <input id="idUpd" type="text"></input><br>
+                        <button type="submit" onclick="getDataForId();">getDataForId</button><br>
+                        Név (kötelező, max 30): <input id="name2" type="text"></input><br>
+                        Height (kötelező, max 30): <input id="height2" type="text"></input><br>
+                        Weight (kötelező, max 30): <input id="weight2" type="text"></input><br>
+                        <button type="submit" onclick="update();">Update</button><br>
+                        <div id='updateResult'></div>
+                    </div>
+                    <div class="box">
+                        <h3>Adat törlése</h3>
+                        ID (kötelező): <input id="idDel" type="text"></input><br>
+                        <button type="submit" onclick="deleteF();">Delete</button><br>
+                        <p id="deleteResult"></p>
+                    </div>
+                </div>
+            </section>
+            <footer>Óré Szabina Vivien VE22CS & Bozsóki Márk I6SUE5</footer>
+        </div>
+    </div>
+    <script type="text/javascript" src="ajax.js"></script>
+</body>
+
+</html>
path: resources/5/ajax.html
user: login: markbozsoki
body: nitpick: missig new line at the end of file
created_at: 2025-03-23T15:21:45Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<html lang="hu">
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Web-programozás-1 Előadás Házi feladat - AJAX</title>
+    <link type="text/css" rel="stylesheet" href="../main.css">
+    <link rel="stylesheet" href="style.css">
+</head>
+
+<body>
+    <div id="pageContainer">
+        <div id="contentWrap">
+            <header>
+                <h1 class="header">Web-programozás-1 Előadás Házi feladat</h1>
+            </header>
+            <nav>
+                <ul>
+                    <li><a href="../../index.html">Főoldal</a></li>
+                    <li><a href="../2/tablazat.html">Táblázat</a></li>
+                    <li><a href="../3/html5.html">HTML5</a></li>
+                    <li><a href="../4/chartjs.html">ChartJS</a></li>
+                    <li><a href="ajax.html" class="active">AJAX</a></li>
+                    <li><a href="../oojs.html">OOJS</a></li>
+                </ul>
+            </nav>
+            <aside>
+                <h1>AJAX alkalmazás</h1>
+                <hr>
+                <h2>Az 5. feladat megvalósítása</h2>
+            </aside>
+            <section>
+                <h1>AJAX alkalmazás</h1>
path: resources/5/ajax.html
user: login: markbozsoki
body: please put this into an acticle element
created_at: 2025-03-23T17:03:30Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<html lang="hu">
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Web-programozás-1 Előadás Házi feladat - AJAX</title>
+    <link type="text/css" rel="stylesheet" href="../main.css">
+    <link rel="stylesheet" href="style.css">
+</head>
+
+<body>
+    <div id="pageContainer">
+        <div id="contentWrap">
+            <header>
+                <h1 class="header">Web-programozás-1 Előadás Házi feladat</h1>
+            </header>
+            <nav>
+                <ul>
+                    <li><a href="../../index.html">Főoldal</a></li>
+                    <li><a href="../2/tablazat.html">Táblázat</a></li>
+                    <li><a href="../3/html5.html">HTML5</a></li>
+                    <li><a href="../4/chartjs.html">ChartJS</a></li>
+                    <li><a href="ajax.html" class="active">AJAX</a></li>
+                    <li><a href="../oojs.html">OOJS</a></li>
+                </ul>
+            </nav>
+            <aside>
+                <h1>AJAX alkalmazás</h1>
+                <hr>
+                <h2>Az 5. feladat megvalósítása</h2>
+            </aside>
+            <section>
+                <h1>AJAX alkalmazás</h1>
path: resources/5/ajax.html
user: login: MoSzabina
body: done
created_at: 2025-03-23T19:27:07Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,223 @@
+const url = "http://gamf.nhely.hu/ajax2/";
+const code = "VE22CSabc123";
+document.getElementById("code").innerHTML = "code=" + code;
+
+async function read() {
+  try {
+    let response = await fetch(url, {
+      method: 'post',
+      cache: 'no-cache',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+      body: "code=" + code + "&op=read"
+    });
+    let data = await response.text();
+    try {
+      data = JSON.parse(data);
+    } catch (jsonError) {
+      console.error("Hiba: A válasz nem JSON formátumú!", data);
+      return;
+    }
+
+    let list = data.list;
+    let sum = 0;
+    let max = 0;
+
+    let str = "<h3>Adatok lekérése</h3>";
path: resources/5/ajax.js
user: login: MoSzabina
body: 27. sor helyett: let str = ""; mivel kétszer jelenítette meg az adatok lekérése feliratot
created_at: 2025-03-23T20:15:35Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html lang="hu">
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Web-programozás-1 Előadás Házi feladat - AJAX</title>
+    <link type="text/css" rel="stylesheet" href="../main.css">
+    <link rel="stylesheet" href="style.css">
path: resources/5/ajax.html
user: login: markbozsoki
body: missing link type
created_at: 2025-03-23T20:45:22Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html lang="hu">
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Web-programozás-1 Előadás Házi feladat - AJAX</title>
+    <link type="text/css" rel="stylesheet" href="../main.css">
+    <link rel="stylesheet" href="style.css">
+</head>
+
+<body>
+    <div id="pageContainer">
+        <div id="contentWrap">
+            <header>
+                <h1 class="header">Web-programozás-1 Előadás Házi feladat</h1>
+            </header>
+            <nav>
+                <ul>
+                    <li><a href="../../index.html">Főoldal</a></li>
+                    <li><a href="../2/tablazat.html">Táblázat</a></li>
+                    <li><a href="../3/html5.html">HTML5</a></li>
+                    <li><a href="../4/chartjs.html">ChartJS</a></li>
+                    <li><a href="ajax.html" class="active">AJAX</a></li>
+                    <li><a href="../oojs.html">OOJS</a></li>
path: resources/5/ajax.html
user: login: markbozsoki
body: missing directory number (6)
created_at: 2025-03-23T20:46:03Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html lang="hu">
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Web-programozás-1 Előadás Házi feladat - AJAX</title>
+    <link type="text/css" rel="stylesheet" href="../main.css">
+    <link rel="stylesheet" href="style.css">
+</head>
+
+<body>
+    <div id="pageContainer">
+        <div id="contentWrap">
+            <header>
+                <h1 class="header">Web-programozás-1 Előadás Házi feladat</h1>
+            </header>
+            <nav>
+                <ul>
+                    <li><a href="../../index.html">Főoldal</a></li>
+                    <li><a href="../2/tablazat.html">Táblázat</a></li>
+                    <li><a href="../3/html5.html">HTML5</a></li>
+                    <li><a href="../4/chartjs.html">ChartJS</a></li>
+                    <li><a href="ajax.html" class="active">AJAX</a></li>
+                    <li><a href="../oojs.html">OOJS</a></li>
+                </ul>
+            </nav>
+            <aside>
+                <h1>AJAX alkalmazás</h1>
+                <hr>
+                <h2>Az 5. feladat megvalósítása</h2>
+            </aside>
+            <section>
+                <article>
+                <h1>AJAX alkalmazás</h1>
+                </article>
+                <div class="container">
+                    <div class="box">
+                        <p id="code">code= VE22CSabc123</p>
+                        <h3>Adatok lekérése</h3>
+                        <button id="readBtn">Adatok lekérése</button>
path: resources/5/ajax.html
user: login: markbozsoki
body: Can you please rename "readBtn" to "readButton", update the id in the javascript as well! 
created_at: 2025-03-23T20:47:49Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html lang="hu">
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Web-programozás-1 Előadás Házi feladat - AJAX</title>
+    <link type="text/css" rel="stylesheet" href="../main.css">
+    <link rel="stylesheet" href="style.css">
+</head>
+
+<body>
+    <div id="pageContainer">
+        <div id="contentWrap">
+            <header>
+                <h1 class="header">Web-programozás-1 Előadás Házi feladat</h1>
+            </header>
+            <nav>
+                <ul>
+                    <li><a href="../../index.html">Főoldal</a></li>
+                    <li><a href="../2/tablazat.html">Táblázat</a></li>
+                    <li><a href="../3/html5.html">HTML5</a></li>
+                    <li><a href="../4/chartjs.html">ChartJS</a></li>
+                    <li><a href="ajax.html" class="active">AJAX</a></li>
+                    <li><a href="../oojs.html">OOJS</a></li>
+                </ul>
+            </nav>
+            <aside>
+                <h1>AJAX alkalmazás</h1>
+                <hr>
+                <h2>Az 5. feladat megvalósítása</h2>
+            </aside>
+            <section>
+                <article>
+                <h1>AJAX alkalmazás</h1>
+                </article>
+                <div class="container">
+                    <div class="box">
+                        <p id="code">code= VE22CSabc123</p>
+                        <h3>Adatok lekérése</h3>
+                        <button id="readBtn">Adatok lekérése</button>
+                        <div id="readDiv"></div>
+                    </div>
+                    <div class="box">
+                        <h3>Magasság Statisztika</h3>
+                        <p>Összeg: <span id="sumHeight">-</span></p>
+                        <p>Átlag: <span id="avgHeight">-</span></p>
+                        <p>Legnagyobb: <span id="maxHeight">-</span></p>
+                    </div>
+                    <div class="box">
+                        <h3>Új adat létrehozása</h3>
+                        Név (kötelező, max 30):<br><input id="name1" type="text"></input><br>
path: resources/5/ajax.html
user: login: markbozsoki
body: Can you please rename "name1" to "newNameInput", update the id in the javascript as well! 
created_at: 2025-03-23T20:48:41Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html lang="hu">
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Web-programozás-1 Előadás Házi feladat - AJAX</title>
+    <link type="text/css" rel="stylesheet" href="../main.css">
+    <link rel="stylesheet" href="style.css">
+</head>
+
+<body>
+    <div id="pageContainer">
+        <div id="contentWrap">
+            <header>
+                <h1 class="header">Web-programozás-1 Előadás Házi feladat</h1>
+            </header>
+            <nav>
+                <ul>
+                    <li><a href="../../index.html">Főoldal</a></li>
+                    <li><a href="../2/tablazat.html">Táblázat</a></li>
+                    <li><a href="../3/html5.html">HTML5</a></li>
+                    <li><a href="../4/chartjs.html">ChartJS</a></li>
+                    <li><a href="ajax.html" class="active">AJAX</a></li>
+                    <li><a href="../oojs.html">OOJS</a></li>
+                </ul>
+            </nav>
+            <aside>
+                <h1>AJAX alkalmazás</h1>
+                <hr>
+                <h2>Az 5. feladat megvalósítása</h2>
+            </aside>
+            <section>
+                <article>
+                <h1>AJAX alkalmazás</h1>
+                </article>
+                <div class="container">
+                    <div class="box">
+                        <p id="code">code= VE22CSabc123</p>
+                        <h3>Adatok lekérése</h3>
+                        <button id="readBtn">Adatok lekérése</button>
+                        <div id="readDiv"></div>
+                    </div>
+                    <div class="box">
+                        <h3>Magasság Statisztika</h3>
+                        <p>Összeg: <span id="sumHeight">-</span></p>
+                        <p>Átlag: <span id="avgHeight">-</span></p>
+                        <p>Legnagyobb: <span id="maxHeight">-</span></p>
+                    </div>
+                    <div class="box">
+                        <h3>Új adat létrehozása</h3>
+                        Név (kötelező, max 30):<br><input id="name1" type="text"></input><br>
+                        Magasság (cm) (kötelező, max 30): <input id="height1" type="text"></input><br>
path: resources/5/ajax.html
user: login: markbozsoki
body: Can you please rename "height1" to "newHeightInput", update the id in the javascript as well! 
created_at: 2025-03-23T20:49:05Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html lang="hu">
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Web-programozás-1 Előadás Házi feladat - AJAX</title>
+    <link type="text/css" rel="stylesheet" href="../main.css">
+    <link rel="stylesheet" href="style.css">
+</head>
+
+<body>
+    <div id="pageContainer">
+        <div id="contentWrap">
+            <header>
+                <h1 class="header">Web-programozás-1 Előadás Házi feladat</h1>
+            </header>
+            <nav>
+                <ul>
+                    <li><a href="../../index.html">Főoldal</a></li>
+                    <li><a href="../2/tablazat.html">Táblázat</a></li>
+                    <li><a href="../3/html5.html">HTML5</a></li>
+                    <li><a href="../4/chartjs.html">ChartJS</a></li>
+                    <li><a href="ajax.html" class="active">AJAX</a></li>
+                    <li><a href="../oojs.html">OOJS</a></li>
+                </ul>
+            </nav>
+            <aside>
+                <h1>AJAX alkalmazás</h1>
+                <hr>
+                <h2>Az 5. feladat megvalósítása</h2>
+            </aside>
+            <section>
+                <article>
+                <h1>AJAX alkalmazás</h1>
+                </article>
+                <div class="container">
+                    <div class="box">
+                        <p id="code">code= VE22CSabc123</p>
+                        <h3>Adatok lekérése</h3>
+                        <button id="readBtn">Adatok lekérése</button>
+                        <div id="readDiv"></div>
+                    </div>
+                    <div class="box">
+                        <h3>Magasság Statisztika</h3>
+                        <p>Összeg: <span id="sumHeight">-</span></p>
+                        <p>Átlag: <span id="avgHeight">-</span></p>
+                        <p>Legnagyobb: <span id="maxHeight">-</span></p>
+                    </div>
+                    <div class="box">
+                        <h3>Új adat létrehozása</h3>
+                        Név (kötelező, max 30):<br><input id="name1" type="text"></input><br>
+                        Magasság (cm) (kötelező, max 30): <input id="height1" type="text"></input><br>
+                        Súly (kg) (kötelező, max 30): <input id="weight1" type="text"></input><br>
path: resources/5/ajax.html
user: login: markbozsoki
body: Can you please rename "weight1" to "newWeightInput", update the id in the javascript as well!
created_at: 2025-03-23T20:49:25Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html lang="hu">
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Web-programozás-1 Előadás Házi feladat - AJAX</title>
+    <link type="text/css" rel="stylesheet" href="../main.css">
+    <link rel="stylesheet" href="style.css">
+</head>
+
+<body>
+    <div id="pageContainer">
+        <div id="contentWrap">
+            <header>
+                <h1 class="header">Web-programozás-1 Előadás Házi feladat</h1>
+            </header>
+            <nav>
+                <ul>
+                    <li><a href="../../index.html">Főoldal</a></li>
+                    <li><a href="../2/tablazat.html">Táblázat</a></li>
+                    <li><a href="../3/html5.html">HTML5</a></li>
+                    <li><a href="../4/chartjs.html">ChartJS</a></li>
+                    <li><a href="ajax.html" class="active">AJAX</a></li>
+                    <li><a href="../oojs.html">OOJS</a></li>
+                </ul>
+            </nav>
+            <aside>
+                <h1>AJAX alkalmazás</h1>
+                <hr>
+                <h2>Az 5. feladat megvalósítása</h2>
+            </aside>
+            <section>
+                <article>
+                <h1>AJAX alkalmazás</h1>
+                </article>
+                <div class="container">
+                    <div class="box">
+                        <p id="code">code= VE22CSabc123</p>
+                        <h3>Adatok lekérése</h3>
+                        <button id="readBtn">Adatok lekérése</button>
+                        <div id="readDiv"></div>
+                    </div>
+                    <div class="box">
+                        <h3>Magasság Statisztika</h3>
+                        <p>Összeg: <span id="sumHeight">-</span></p>
+                        <p>Átlag: <span id="avgHeight">-</span></p>
+                        <p>Legnagyobb: <span id="maxHeight">-</span></p>
+                    </div>
+                    <div class="box">
+                        <h3>Új adat létrehozása</h3>
+                        Név (kötelező, max 30):<br><input id="name1" type="text"></input><br>
+                        Magasság (cm) (kötelező, max 30): <input id="height1" type="text"></input><br>
+                        Súly (kg) (kötelező, max 30): <input id="weight1" type="text"></input><br>
+                        <button type="submit" onclick="create();">Létrehoz</button><br>
+                        <div id="createDiv"></div>
+                        <div id='createResult'></div>
+                    </div>
+                    <div class="box">
+                        <h3>Update</h3>
+                        ID (kötelező): <input id="idUpd" type="text"></input><br>
+                        <button type="submit" onclick="getDataForId();">ID adat lekérése</button><br>
+                        Név (kötelező, max 30):<br><input id="name2" type="text"></input><br>
path: resources/5/ajax.html
user: login: markbozsoki
body: Can you please rename "name2" to "updateNameInput", update the id in the javascript as well!
created_at: 2025-03-23T20:50:25Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html lang="hu">
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Web-programozás-1 Előadás Házi feladat - AJAX</title>
+    <link type="text/css" rel="stylesheet" href="../main.css">
+    <link rel="stylesheet" href="style.css">
+</head>
+
+<body>
+    <div id="pageContainer">
+        <div id="contentWrap">
+            <header>
+                <h1 class="header">Web-programozás-1 Előadás Házi feladat</h1>
+            </header>
+            <nav>
+                <ul>
+                    <li><a href="../../index.html">Főoldal</a></li>
+                    <li><a href="../2/tablazat.html">Táblázat</a></li>
+                    <li><a href="../3/html5.html">HTML5</a></li>
+                    <li><a href="../4/chartjs.html">ChartJS</a></li>
+                    <li><a href="ajax.html" class="active">AJAX</a></li>
+                    <li><a href="../oojs.html">OOJS</a></li>
+                </ul>
+            </nav>
+            <aside>
+                <h1>AJAX alkalmazás</h1>
+                <hr>
+                <h2>Az 5. feladat megvalósítása</h2>
+            </aside>
+            <section>
+                <article>
+                <h1>AJAX alkalmazás</h1>
+                </article>
+                <div class="container">
+                    <div class="box">
+                        <p id="code">code= VE22CSabc123</p>
+                        <h3>Adatok lekérése</h3>
+                        <button id="readBtn">Adatok lekérése</button>
+                        <div id="readDiv"></div>
+                    </div>
+                    <div class="box">
+                        <h3>Magasság Statisztika</h3>
+                        <p>Összeg: <span id="sumHeight">-</span></p>
+                        <p>Átlag: <span id="avgHeight">-</span></p>
+                        <p>Legnagyobb: <span id="maxHeight">-</span></p>
+                    </div>
+                    <div class="box">
+                        <h3>Új adat létrehozása</h3>
+                        Név (kötelező, max 30):<br><input id="name1" type="text"></input><br>
+                        Magasság (cm) (kötelező, max 30): <input id="height1" type="text"></input><br>
+                        Súly (kg) (kötelező, max 30): <input id="weight1" type="text"></input><br>
+                        <button type="submit" onclick="create();">Létrehoz</button><br>
+                        <div id="createDiv"></div>
+                        <div id='createResult'></div>
+                    </div>
+                    <div class="box">
+                        <h3>Update</h3>
+                        ID (kötelező): <input id="idUpd" type="text"></input><br>
+                        <button type="submit" onclick="getDataForId();">ID adat lekérése</button><br>
+                        Név (kötelező, max 30):<br><input id="name2" type="text"></input><br>
+                        Magasság (kötelező, max 30):<br><input id="height2" type="text"></input><br>
path: resources/5/ajax.html
user: login: markbozsoki
body: Can you please rename "height2" to "updateHeightInput", update the id in the javascript as well!
created_at: 2025-03-23T20:50:46Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html lang="hu">
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Web-programozás-1 Előadás Házi feladat - AJAX</title>
+    <link type="text/css" rel="stylesheet" href="../main.css">
+    <link rel="stylesheet" href="style.css">
+</head>
+
+<body>
+    <div id="pageContainer">
+        <div id="contentWrap">
+            <header>
+                <h1 class="header">Web-programozás-1 Előadás Házi feladat</h1>
+            </header>
+            <nav>
+                <ul>
+                    <li><a href="../../index.html">Főoldal</a></li>
+                    <li><a href="../2/tablazat.html">Táblázat</a></li>
+                    <li><a href="../3/html5.html">HTML5</a></li>
+                    <li><a href="../4/chartjs.html">ChartJS</a></li>
+                    <li><a href="ajax.html" class="active">AJAX</a></li>
+                    <li><a href="../oojs.html">OOJS</a></li>
+                </ul>
+            </nav>
+            <aside>
+                <h1>AJAX alkalmazás</h1>
+                <hr>
+                <h2>Az 5. feladat megvalósítása</h2>
+            </aside>
+            <section>
+                <article>
+                <h1>AJAX alkalmazás</h1>
+                </article>
+                <div class="container">
+                    <div class="box">
+                        <p id="code">code= VE22CSabc123</p>
+                        <h3>Adatok lekérése</h3>
+                        <button id="readBtn">Adatok lekérése</button>
+                        <div id="readDiv"></div>
+                    </div>
+                    <div class="box">
+                        <h3>Magasság Statisztika</h3>
+                        <p>Összeg: <span id="sumHeight">-</span></p>
+                        <p>Átlag: <span id="avgHeight">-</span></p>
+                        <p>Legnagyobb: <span id="maxHeight">-</span></p>
+                    </div>
+                    <div class="box">
+                        <h3>Új adat létrehozása</h3>
+                        Név (kötelező, max 30):<br><input id="name1" type="text"></input><br>
+                        Magasság (cm) (kötelező, max 30): <input id="height1" type="text"></input><br>
+                        Súly (kg) (kötelező, max 30): <input id="weight1" type="text"></input><br>
+                        <button type="submit" onclick="create();">Létrehoz</button><br>
+                        <div id="createDiv"></div>
+                        <div id='createResult'></div>
+                    </div>
+                    <div class="box">
+                        <h3>Update</h3>
+                        ID (kötelező): <input id="idUpd" type="text"></input><br>
+                        <button type="submit" onclick="getDataForId();">ID adat lekérése</button><br>
+                        Név (kötelező, max 30):<br><input id="name2" type="text"></input><br>
+                        Magasság (kötelező, max 30):<br><input id="height2" type="text"></input><br>
+                        Súly (kötelező, max 30):<br><input id="weight2" type="text"></input><br>
path: resources/5/ajax.html
user: login: markbozsoki
body: Can you please rename "weight2" to "updateWeightInput", update the id in the javascript as well!
created_at: 2025-03-23T20:51:11Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html lang="hu">
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Web-programozás-1 Előadás Házi feladat - AJAX</title>
+    <link type="text/css" rel="stylesheet" href="../main.css">
+    <link rel="stylesheet" href="style.css">
+</head>
+
+<body>
+    <div id="pageContainer">
+        <div id="contentWrap">
+            <header>
+                <h1 class="header">Web-programozás-1 Előadás Házi feladat</h1>
+            </header>
+            <nav>
+                <ul>
+                    <li><a href="../../index.html">Főoldal</a></li>
+                    <li><a href="../2/tablazat.html">Táblázat</a></li>
+                    <li><a href="../3/html5.html">HTML5</a></li>
+                    <li><a href="../4/chartjs.html">ChartJS</a></li>
+                    <li><a href="ajax.html" class="active">AJAX</a></li>
+                    <li><a href="../oojs.html">OOJS</a></li>
+                </ul>
+            </nav>
+            <aside>
+                <h1>AJAX alkalmazás</h1>
+                <hr>
+                <h2>Az 5. feladat megvalósítása</h2>
+            </aside>
+            <section>
+                <article>
+                <h1>AJAX alkalmazás</h1>
+                </article>
+                <div class="container">
+                    <div class="box">
+                        <p id="code">code= VE22CSabc123</p>
+                        <h3>Adatok lekérése</h3>
+                        <button id="readBtn">Adatok lekérése</button>
+                        <div id="readDiv"></div>
+                    </div>
+                    <div class="box">
+                        <h3>Magasság Statisztika</h3>
+                        <p>Összeg: <span id="sumHeight">-</span></p>
+                        <p>Átlag: <span id="avgHeight">-</span></p>
+                        <p>Legnagyobb: <span id="maxHeight">-</span></p>
+                    </div>
+                    <div class="box">
+                        <h3>Új adat létrehozása</h3>
+                        Név (kötelező, max 30):<br><input id="name1" type="text"></input><br>
+                        Magasság (cm) (kötelező, max 30): <input id="height1" type="text"></input><br>
+                        Súly (kg) (kötelező, max 30): <input id="weight1" type="text"></input><br>
+                        <button type="submit" onclick="create();">Létrehoz</button><br>
+                        <div id="createDiv"></div>
+                        <div id='createResult'></div>
+                    </div>
+                    <div class="box">
+                        <h3>Update</h3>
+                        ID (kötelező): <input id="idUpd" type="text"></input><br>
+                        <button type="submit" onclick="getDataForId();">ID adat lekérése</button><br>
+                        Név (kötelező, max 30):<br><input id="name2" type="text"></input><br>
+                        Magasság (kötelező, max 30):<br><input id="height2" type="text"></input><br>
+                        Súly (kötelező, max 30):<br><input id="weight2" type="text"></input><br>
+                        <button type="submit" onclick="update();">Frissítés</button><br>
+                        <div id='updateResult'></div>
+                    </div>
+                    <div class="box">
+                        <h3>Adat törlése</h3>
+                        ID (kötelező): <input id="idDel" type="text"></input><br>
path: resources/5/ajax.html
user: login: markbozsoki
body: Can you please rename "idDel" to "idToDeleteInput", update the id in the javascript as well!
created_at: 2025-03-23T20:51:46Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,223 @@
+const url = "http://gamf.nhely.hu/ajax2/";
+const code = "VE22CSabc123";
+document.getElementById("code").innerHTML = "code=" + code;
+
+async function read() {
+  try {
+    let response = await fetch(url, {
+      method: 'post',
+      cache: 'no-cache',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+      body: "code=" + code + "&op=read"
+    });
+    let data = await response.text();
+    try {
+      data = JSON.parse(data);
+    } catch (jsonError) {
+      console.error("Hiba: A válasz nem JSON formátumú!", data);
+      return;
+    }
+
+    let list = data.list;
+    let sum = 0;
+    let max = 0;
+
+    let str = "<h3>Adatok lekérése</h3>";
+    str += "<p>Rekordok száma: " + data.rowCount + "</p>";
+    str += "<p>Utolsó max " + data.maxNum + " records:</p>";
+    str += "<table><tr><th>id</th><th>\tname</th><th>height</th><th>weight</th><th>code</th></tr>";
path: resources/5/ajax.js
user: login: markbozsoki
body: Please use hungarian words in the table header as well!
created_at: 2025-03-23T20:53:49Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html lang="hu">
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Web-programozás-1 Előadás Házi feladat - AJAX</title>
+    <link type="text/css" rel="stylesheet" href="../main.css">
+    <link rel="stylesheet" href="style.css">
+</head>
+
+<body>
+    <div id="pageContainer">
+        <div id="contentWrap">
+            <header>
+                <h1 class="header">Web-programozás-1 Előadás Házi feladat</h1>
+            </header>
+            <nav>
+                <ul>
+                    <li><a href="../../index.html">Főoldal</a></li>
+                    <li><a href="../2/tablazat.html">Táblázat</a></li>
+                    <li><a href="../3/html5.html">HTML5</a></li>
+                    <li><a href="../4/chartjs.html">ChartJS</a></li>
+                    <li><a href="ajax.html" class="active">AJAX</a></li>
+                    <li><a href="../oojs.html">OOJS</a></li>
+                </ul>
+            </nav>
+            <aside>
+                <h1>AJAX alkalmazás</h1>
+                <hr>
+                <h2>Az 5. feladat megvalósítása</h2>
+            </aside>
+            <section>
+                <article>
+                <h1>AJAX alkalmazás</h1>
+                </article>
+                <div class="container">
+                    <div class="box">
+                        <p id="code">code= VE22CSabc123</p>
+                        <h3>Adatok lekérése</h3>
+                        <button id="readBtn">Adatok lekérése</button>
+                        <div id="readDiv"></div>
+                    </div>
+                    <div class="box">
+                        <h3>Magasság Statisztika</h3>
+                        <p>Összeg: <span id="sumHeight">-</span></p>
+                        <p>Átlag: <span id="avgHeight">-</span></p>
+                        <p>Legnagyobb: <span id="maxHeight">-</span></p>
+                    </div>
+                    <div class="box">
+                        <h3>Új adat létrehozása</h3>
+                        Név (kötelező, max 30):<br><input id="name1" type="text"></input><br>
+                        Magasság (cm) (kötelező, max 30): <input id="height1" type="text"></input><br>
+                        Súly (kg) (kötelező, max 30): <input id="weight1" type="text"></input><br>
+                        <button type="submit" onclick="create();">Létrehoz</button><br>
+                        <div id="createDiv"></div>
+                        <div id='createResult'></div>
+                    </div>
+                    <div class="box">
+                        <h3>Update</h3>
path: resources/5/ajax.html
user: login: markbozsoki
body: "Update" -> "Módosítás"
created_at: 2025-03-23T20:54:51Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html lang="hu">
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Web-programozás-1 Előadás Házi feladat - AJAX</title>
+    <link type="text/css" rel="stylesheet" href="../main.css">
+    <link rel="stylesheet" href="style.css">
+</head>
+
+<body>
+    <div id="pageContainer">
+        <div id="contentWrap">
+            <header>
+                <h1 class="header">Web-programozás-1 Előadás Házi feladat</h1>
+            </header>
+            <nav>
+                <ul>
+                    <li><a href="../../index.html">Főoldal</a></li>
+                    <li><a href="../2/tablazat.html">Táblázat</a></li>
+                    <li><a href="../3/html5.html">HTML5</a></li>
+                    <li><a href="../4/chartjs.html">ChartJS</a></li>
+                    <li><a href="ajax.html" class="active">AJAX</a></li>
+                    <li><a href="../oojs.html">OOJS</a></li>
+                </ul>
+            </nav>
+            <aside>
+                <h1>AJAX alkalmazás</h1>
+                <hr>
+                <h2>Az 5. feladat megvalósítása</h2>
+            </aside>
+            <section>
+                <article>
+                <h1>AJAX alkalmazás</h1>
+                </article>
+                <div class="container">
+                    <div class="box">
+                        <p id="code">code= VE22CSabc123</p>
+                        <h3>Adatok lekérése</h3>
+                        <button id="readBtn">Adatok lekérése</button>
+                        <div id="readDiv"></div>
+                    </div>
+                    <div class="box">
+                        <h3>Magasság Statisztika</h3>
+                        <p>Összeg: <span id="sumHeight">-</span></p>
+                        <p>Átlag: <span id="avgHeight">-</span></p>
+                        <p>Legnagyobb: <span id="maxHeight">-</span></p>
+                    </div>
+                    <div class="box">
+                        <h3>Új adat létrehozása</h3>
+                        Név (kötelező, max 30):<br><input id="name1" type="text"></input><br>
+                        Magasság (cm) (kötelező, max 30): <input id="height1" type="text"></input><br>
+                        Súly (kg) (kötelező, max 30): <input id="weight1" type="text"></input><br>
+                        <button type="submit" onclick="create();">Létrehoz</button><br>
+                        <div id="createDiv"></div>
+                        <div id='createResult'></div>
+                    </div>
+                    <div class="box">
+                        <h3>Update</h3>
+                        ID (kötelező): <input id="idUpd" type="text"></input><br>
path: resources/5/ajax.html
user: login: markbozsoki
body: Can you please rename "idUpd" to "idUpdateInput", update the id in the javascript as well!
created_at: 2025-03-23T20:55:24Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,223 @@
+const url = "http://gamf.nhely.hu/ajax2/";
+const code = "VE22CSabc123";
+document.getElementById("code").innerHTML = "code=" + code;
+
+async function read() {
+  try {
+    let response = await fetch(url, {
+      method: 'post',
+      cache: 'no-cache',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+      body: "code=" + code + "&op=read"
+    });
+    let data = await response.text();
+    try {
+      data = JSON.parse(data);
+    } catch (jsonError) {
+      console.error("Hiba: A válasz nem JSON formátumú!", data);
path: resources/5/ajax.js
user: login: markbozsoki
body: Console log messages should be in English, it is for the developers not for the Users
created_at: 2025-03-23T20:56:53Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,223 @@
+const url = "http://gamf.nhely.hu/ajax2/";
+const code = "VE22CSabc123";
+document.getElementById("code").innerHTML = "code=" + code;
+
+async function read() {
+  try {
+    let response = await fetch(url, {
+      method: 'post',
+      cache: 'no-cache',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+      body: "code=" + code + "&op=read"
+    });
+    let data = await response.text();
+    try {
+      data = JSON.parse(data);
+    } catch (jsonError) {
+      console.error("Hiba: A válasz nem JSON formátumú!", data);
+      return;
+    }
+
+    let list = data.list;
+    let sum = 0;
+    let max = 0;
+
+    let str = "<h3>Adatok lekérése</h3>";
+    str += "<p>Rekordok száma: " + data.rowCount + "</p>";
+    str += "<p>Utolsó max " + data.maxNum + " records:</p>";
+    str += "<table><tr><th>id</th><th>\tname</th><th>height</th><th>weight</th><th>code</th></tr>";
+
+    for (let i = 0; i < list.length; i++) {
+      let height = parseFloat(list[i].height);
+      if (!isNaN(height)) {
+        sum += height;
+        if (height > max) {
+          max = height;
+        }
+      }
+      str += `<tr>
+              <td>${list[i].id}</td>
+              <td>${list[i].name}</td>
+              <td>${list[i].height}</td>
+              <td>${list[i].weight}</td>
+              <td>${list[i].code}</td>
+          </tr>`;
+    }
+    str += "</table>";
+
+    let readDiv = document.getElementById("readDiv");
+    if (readDiv) {
+      readDiv.innerHTML = str;
+    }
+    else {
+      console.error("Hiba: readDiv nem található az oldalon!");
path: resources/5/ajax.js
user: login: markbozsoki
body: Console log messages should be in English, it is for the developers not for the Users
created_at: 2025-03-23T20:57:00Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,223 @@
+const url = "http://gamf.nhely.hu/ajax2/";
+const code = "VE22CSabc123";
+document.getElementById("code").innerHTML = "code=" + code;
+
+async function read() {
+  try {
+    let response = await fetch(url, {
+      method: 'post',
+      cache: 'no-cache',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+      body: "code=" + code + "&op=read"
+    });
+    let data = await response.text();
+    try {
+      data = JSON.parse(data);
+    } catch (jsonError) {
+      console.error("Hiba: A válasz nem JSON formátumú!", data);
+      return;
+    }
+
+    let list = data.list;
+    let sum = 0;
+    let max = 0;
+
+    let str = "<h3>Adatok lekérése</h3>";
+    str += "<p>Rekordok száma: " + data.rowCount + "</p>";
+    str += "<p>Utolsó max " + data.maxNum + " records:</p>";
+    str += "<table><tr><th>id</th><th>\tname</th><th>height</th><th>weight</th><th>code</th></tr>";
+
+    for (let i = 0; i < list.length; i++) {
+      let height = parseFloat(list[i].height);
+      if (!isNaN(height)) {
+        sum += height;
+        if (height > max) {
+          max = height;
+        }
+      }
+      str += `<tr>
+              <td>${list[i].id}</td>
+              <td>${list[i].name}</td>
+              <td>${list[i].height}</td>
+              <td>${list[i].weight}</td>
+              <td>${list[i].code}</td>
+          </tr>`;
+    }
+    str += "</table>";
+
+    let readDiv = document.getElementById("readDiv");
+    if (readDiv) {
+      readDiv.innerHTML = str;
+    }
+    else {
+      console.error("Hiba: readDiv nem található az oldalon!");
+    }
+
+    let count = list.length;
+    let avg = count > 0 ? (sum / count).toFixed(2) : 0;
+
+    document.getElementById("sumHeight").innerText = sum;
+    document.getElementById("avgHeight").innerText = avg;
+    document.getElementById("maxHeight").innerText = max;
+
+  } catch (error) {
+    console.error("Hiba az API hívás során:", error);
+  }
+}
+
+async function create() {
+  let nameStr = document.getElementById("name1").value;
+  if (nameStr == "" || nameStr.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás név!";
+    return;
+  }
+
+  let height = document.getElementById("height1").value;
+  if (height == "" || height.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás magasság!";
+    return;
+  }
+
+  let weight = document.getElementById("weight1").value;
+  if (weight == "" || weight.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás súly!";
+    return;
+  }
+
+  let response = await fetch(url, {
+    method: 'post',
+    cache: 'no-cache',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    body: "code=" + code + "&op=create&name=" + nameStr + "&height=" + height + "&weight=" + weight
+  });
+
+  let data = await response.text();
+  if (data > 0) {
+    str = "Sikeresen létrehozva";
+  }
+  else {
+    str = "Létrehozás sikertelen!";
+    return;
+  }
+
+  document.getElementById("createResult").innerHTML = str;
+  document.getElementById("name1").value = "";
+  document.getElementById("height1").value = "";
+  document.getElementById("weight1").value = "";
+  read();
+}
+
+async function getDataForId() {
+  let id = document.getElementById("idUpd").value;
+  if (id == "") {  //filter needless API calls
+    return;
+  }
+
+  let response = await fetch(url, {
+    method: 'post',
+    cache: 'no-cache',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    body: "code=" + code + "&op=read"
+  });
+
+  let data = await response.text();
+  let parsed_data = null;
+  try {
+    parsed_data = JSON.parse(data);
+  } catch (jsonError) {
+    console.error("Hiba: A válasz nem JSON formátumú!", data);
+    return;
+  }
+  for (let i = 0; i < parsed_data.list.length; i++)
+    if (parsed_data.list[i].id == id) {
+      document.getElementById("name2").value = parsed_data.list[i].name;
+      document.getElementById("height2").value = parsed_data.list[i].height;
+      document.getElementById("weight2").value = parsed_data.list[i].weight;
+    }
+}
+
+async function update() {
+  id = document.getElementById("idUpd").value;
+  if (id == "") {
+    document.getElementById("updateResult").innerHTML = "ID megadása kötelező!";
+    return;
+  }
+
+  let nameStr = document.getElementById("name2").value;
+  if (nameStr == "" || nameStr.length > 30) {
+    document.getElementById("updateResult").innerHTML = "Hibás név!";
+    return;
+  }
+
+  let height = document.getElementById("height2").value;
+  if (height == "" || height.length > 30) {
+    document.getElementById("updateResult").innerHTML = "Hibás magasság!";
+    return;
+  }
+
+  let weight = document.getElementById("weight2").value;
+  if (weight == "" || weight.length > 30) {
+    document.getElementById("updateResult").innerHTML = "Hibás súly!";
+    return;
+  }
+
+  let response = await fetch(url, {
+    method: 'post',
+    cache: 'no-cache',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    body:
+      "code=" + code + "&op=update&id=" + id + "&name=" + nameStr + "&height=" + height + "&weight=" + weight
+  });
+
+  let data = await response.text();
+  if (data > 0) {
+    str = "Frissítés sikeres";
+  }
+  else {
+    str = "Frissítés sikertelen";
+    return;
+  }
+
+  document.getElementById("updateResult").innerHTML = str;
+  document.getElementById("idUpd").value = "";
+  document.getElementById("name2").value = "";
+  document.getElementById("height2").value = "";
+  document.getElementById("weight2").value = "";
+  read();
+}
+
+async function deleteF() {
path: resources/5/ajax.js
user: login: markbozsoki
body: F is not needed at the end of the functions name, please update it in the html  as well!
created_at: 2025-03-23T20:58:17Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,223 @@
+const url = "http://gamf.nhely.hu/ajax2/";
+const code = "VE22CSabc123";
+document.getElementById("code").innerHTML = "code=" + code;
+
+async function read() {
+  try {
+    let response = await fetch(url, {
+      method: 'post',
+      cache: 'no-cache',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+      body: "code=" + code + "&op=read"
+    });
+    let data = await response.text();
+    try {
+      data = JSON.parse(data);
+    } catch (jsonError) {
+      console.error("Hiba: A válasz nem JSON formátumú!", data);
+      return;
+    }
+
+    let list = data.list;
+    let sum = 0;
+    let max = 0;
+
+    let str = "<h3>Adatok lekérése</h3>";
+    str += "<p>Rekordok száma: " + data.rowCount + "</p>";
+    str += "<p>Utolsó max " + data.maxNum + " records:</p>";
+    str += "<table><tr><th>id</th><th>\tname</th><th>height</th><th>weight</th><th>code</th></tr>";
+
+    for (let i = 0; i < list.length; i++) {
+      let height = parseFloat(list[i].height);
+      if (!isNaN(height)) {
+        sum += height;
+        if (height > max) {
+          max = height;
+        }
+      }
+      str += `<tr>
+              <td>${list[i].id}</td>
+              <td>${list[i].name}</td>
+              <td>${list[i].height}</td>
+              <td>${list[i].weight}</td>
+              <td>${list[i].code}</td>
+          </tr>`;
+    }
+    str += "</table>";
+
+    let readDiv = document.getElementById("readDiv");
+    if (readDiv) {
+      readDiv.innerHTML = str;
+    }
+    else {
+      console.error("Hiba: readDiv nem található az oldalon!");
+    }
+
+    let count = list.length;
+    let avg = count > 0 ? (sum / count).toFixed(2) : 0;
+
+    document.getElementById("sumHeight").innerText = sum;
+    document.getElementById("avgHeight").innerText = avg;
+    document.getElementById("maxHeight").innerText = max;
+
+  } catch (error) {
+    console.error("Hiba az API hívás során:", error);
+  }
+}
+
+async function create() {
+  let nameStr = document.getElementById("name1").value;
+  if (nameStr == "" || nameStr.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás név!";
+    return;
+  }
+
+  let height = document.getElementById("height1").value;
+  if (height == "" || height.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás magasság!";
+    return;
+  }
+
+  let weight = document.getElementById("weight1").value;
+  if (weight == "" || weight.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás súly!";
+    return;
+  }
+
+  let response = await fetch(url, {
+    method: 'post',
+    cache: 'no-cache',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    body: "code=" + code + "&op=create&name=" + nameStr + "&height=" + height + "&weight=" + weight
+  });
+
+  let data = await response.text();
+  if (data > 0) {
+    str = "Sikeresen létrehozva";
+  }
+  else {
+    str = "Létrehozás sikertelen!";
+    return;
+  }
+
+  document.getElementById("createResult").innerHTML = str;
+  document.getElementById("name1").value = "";
+  document.getElementById("height1").value = "";
+  document.getElementById("weight1").value = "";
+  read();
+}
+
+async function getDataForId() {
+  let id = document.getElementById("idUpd").value;
+  if (id == "") {  //filter needless API calls
+    return;
+  }
+
+  let response = await fetch(url, {
+    method: 'post',
+    cache: 'no-cache',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    body: "code=" + code + "&op=read"
+  });
+
+  let data = await response.text();
+  let parsed_data = null;
+  try {
+    parsed_data = JSON.parse(data);
+  } catch (jsonError) {
+    console.error("Hiba: A válasz nem JSON formátumú!", data);
+    return;
+  }
+  for (let i = 0; i < parsed_data.list.length; i++)
+    if (parsed_data.list[i].id == id) {
+      document.getElementById("name2").value = parsed_data.list[i].name;
+      document.getElementById("height2").value = parsed_data.list[i].height;
+      document.getElementById("weight2").value = parsed_data.list[i].weight;
+    }
+}
+
+async function update() {
+  id = document.getElementById("idUpd").value;
+  if (id == "") {
+    document.getElementById("updateResult").innerHTML = "ID megadása kötelező!";
+    return;
+  }
+
+  let nameStr = document.getElementById("name2").value;
+  if (nameStr == "" || nameStr.length > 30) {
+    document.getElementById("updateResult").innerHTML = "Hibás név!";
+    return;
+  }
+
+  let height = document.getElementById("height2").value;
+  if (height == "" || height.length > 30) {
+    document.getElementById("updateResult").innerHTML = "Hibás magasság!";
+    return;
+  }
+
+  let weight = document.getElementById("weight2").value;
+  if (weight == "" || weight.length > 30) {
+    document.getElementById("updateResult").innerHTML = "Hibás súly!";
+    return;
+  }
+
+  let response = await fetch(url, {
+    method: 'post',
+    cache: 'no-cache',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    body:
+      "code=" + code + "&op=update&id=" + id + "&name=" + nameStr + "&height=" + height + "&weight=" + weight
+  });
+
+  let data = await response.text();
+  if (data > 0) {
+    str = "Frissítés sikeres";
+  }
+  else {
+    str = "Frissítés sikertelen";
+    return;
+  }
+
+  document.getElementById("updateResult").innerHTML = str;
+  document.getElementById("idUpd").value = "";
+  document.getElementById("name2").value = "";
+  document.getElementById("height2").value = "";
+  document.getElementById("weight2").value = "";
+  read();
+}
+
+async function deleteF() {
+  id = document.getElementById("idDel").value;
+  if (id.length > 0 && id.length <= 30) {
+    let response = await fetch(url, {
+      method: 'post',
+      cache: 'no-cache',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+      body: "code=" + code + "&op=delete&id=" + id
+    });
+    let data = await response.text();
+    if (data > 0)
+      str = "Törlés sikeres";
+    else
path: resources/5/ajax.js
user: login: markbozsoki
body: missing { }
created_at: 2025-03-23T20:58:59Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,223 @@
+const url = "http://gamf.nhely.hu/ajax2/";
+const code = "VE22CSabc123";
+document.getElementById("code").innerHTML = "code=" + code;
+
+async function read() {
+  try {
+    let response = await fetch(url, {
+      method: 'post',
+      cache: 'no-cache',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+      body: "code=" + code + "&op=read"
+    });
+    let data = await response.text();
+    try {
+      data = JSON.parse(data);
+    } catch (jsonError) {
+      console.error("Hiba: A válasz nem JSON formátumú!", data);
+      return;
+    }
+
+    let list = data.list;
+    let sum = 0;
+    let max = 0;
+
+    let str = "<h3>Adatok lekérése</h3>";
+    str += "<p>Rekordok száma: " + data.rowCount + "</p>";
+    str += "<p>Utolsó max " + data.maxNum + " records:</p>";
+    str += "<table><tr><th>id</th><th>\tname</th><th>height</th><th>weight</th><th>code</th></tr>";
+
+    for (let i = 0; i < list.length; i++) {
+      let height = parseFloat(list[i].height);
+      if (!isNaN(height)) {
+        sum += height;
+        if (height > max) {
+          max = height;
+        }
+      }
+      str += `<tr>
+              <td>${list[i].id}</td>
+              <td>${list[i].name}</td>
+              <td>${list[i].height}</td>
+              <td>${list[i].weight}</td>
+              <td>${list[i].code}</td>
+          </tr>`;
+    }
+    str += "</table>";
+
+    let readDiv = document.getElementById("readDiv");
+    if (readDiv) {
+      readDiv.innerHTML = str;
+    }
+    else {
+      console.error("Hiba: readDiv nem található az oldalon!");
+    }
+
+    let count = list.length;
+    let avg = count > 0 ? (sum / count).toFixed(2) : 0;
+
+    document.getElementById("sumHeight").innerText = sum;
+    document.getElementById("avgHeight").innerText = avg;
+    document.getElementById("maxHeight").innerText = max;
+
+  } catch (error) {
+    console.error("Hiba az API hívás során:", error);
+  }
+}
+
+async function create() {
+  let nameStr = document.getElementById("name1").value;
+  if (nameStr == "" || nameStr.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás név!";
+    return;
+  }
+
+  let height = document.getElementById("height1").value;
+  if (height == "" || height.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás magasság!";
+    return;
+  }
+
+  let weight = document.getElementById("weight1").value;
+  if (weight == "" || weight.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás súly!";
+    return;
+  }
+
+  let response = await fetch(url, {
+    method: 'post',
+    cache: 'no-cache',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    body: "code=" + code + "&op=create&name=" + nameStr + "&height=" + height + "&weight=" + weight
+  });
+
+  let data = await response.text();
+  if (data > 0) {
+    str = "Sikeresen létrehozva";
+  }
+  else {
+    str = "Létrehozás sikertelen!";
+    return;
+  }
+
+  document.getElementById("createResult").innerHTML = str;
+  document.getElementById("name1").value = "";
+  document.getElementById("height1").value = "";
+  document.getElementById("weight1").value = "";
+  read();
+}
+
+async function getDataForId() {
+  let id = document.getElementById("idUpd").value;
+  if (id == "") {  //filter needless API calls
+    return;
+  }
+
+  let response = await fetch(url, {
+    method: 'post',
+    cache: 'no-cache',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    body: "code=" + code + "&op=read"
+  });
+
+  let data = await response.text();
+  let parsed_data = null;
+  try {
+    parsed_data = JSON.parse(data);
+  } catch (jsonError) {
+    console.error("Hiba: A válasz nem JSON formátumú!", data);
+    return;
+  }
+  for (let i = 0; i < parsed_data.list.length; i++)
+    if (parsed_data.list[i].id == id) {
+      document.getElementById("name2").value = parsed_data.list[i].name;
+      document.getElementById("height2").value = parsed_data.list[i].height;
+      document.getElementById("weight2").value = parsed_data.list[i].weight;
+    }
+}
+
+async function update() {
+  id = document.getElementById("idUpd").value;
+  if (id == "") {
+    document.getElementById("updateResult").innerHTML = "ID megadása kötelező!";
+    return;
+  }
+
+  let nameStr = document.getElementById("name2").value;
+  if (nameStr == "" || nameStr.length > 30) {
+    document.getElementById("updateResult").innerHTML = "Hibás név!";
+    return;
+  }
+
+  let height = document.getElementById("height2").value;
+  if (height == "" || height.length > 30) {
+    document.getElementById("updateResult").innerHTML = "Hibás magasság!";
+    return;
+  }
+
+  let weight = document.getElementById("weight2").value;
+  if (weight == "" || weight.length > 30) {
+    document.getElementById("updateResult").innerHTML = "Hibás súly!";
+    return;
+  }
+
+  let response = await fetch(url, {
+    method: 'post',
+    cache: 'no-cache',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    body:
+      "code=" + code + "&op=update&id=" + id + "&name=" + nameStr + "&height=" + height + "&weight=" + weight
+  });
+
+  let data = await response.text();
+  if (data > 0) {
+    str = "Frissítés sikeres";
+  }
+  else {
+    str = "Frissítés sikertelen";
+    return;
+  }
+
+  document.getElementById("updateResult").innerHTML = str;
+  document.getElementById("idUpd").value = "";
+  document.getElementById("name2").value = "";
+  document.getElementById("height2").value = "";
+  document.getElementById("weight2").value = "";
+  read();
+}
+
+async function deleteF() {
+  id = document.getElementById("idDel").value;
+  if (id.length > 0 && id.length <= 30) {
+    let response = await fetch(url, {
+      method: 'post',
+      cache: 'no-cache',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+      body: "code=" + code + "&op=delete&id=" + id
+    });
+    let data = await response.text();
+    if (data > 0)
path: resources/5/ajax.js
user: login: markbozsoki
body: missing { }
created_at: 2025-03-23T20:59:03Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,223 @@
+const url = "http://gamf.nhely.hu/ajax2/";
+const code = "VE22CSabc123";
+document.getElementById("code").innerHTML = "code=" + code;
+
+async function read() {
+  try {
+    let response = await fetch(url, {
+      method: 'post',
+      cache: 'no-cache',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+      body: "code=" + code + "&op=read"
+    });
+    let data = await response.text();
+    try {
+      data = JSON.parse(data);
+    } catch (jsonError) {
+      console.error("Hiba: A válasz nem JSON formátumú!", data);
+      return;
+    }
+
+    let list = data.list;
+    let sum = 0;
+    let max = 0;
+
+    let str = "<h3>Adatok lekérése</h3>";
+    str += "<p>Rekordok száma: " + data.rowCount + "</p>";
+    str += "<p>Utolsó max " + data.maxNum + " records:</p>";
+    str += "<table><tr><th>id</th><th>\tname</th><th>height</th><th>weight</th><th>code</th></tr>";
+
+    for (let i = 0; i < list.length; i++) {
+      let height = parseFloat(list[i].height);
+      if (!isNaN(height)) {
+        sum += height;
+        if (height > max) {
+          max = height;
+        }
+      }
+      str += `<tr>
+              <td>${list[i].id}</td>
+              <td>${list[i].name}</td>
+              <td>${list[i].height}</td>
+              <td>${list[i].weight}</td>
+              <td>${list[i].code}</td>
+          </tr>`;
+    }
+    str += "</table>";
+
+    let readDiv = document.getElementById("readDiv");
+    if (readDiv) {
+      readDiv.innerHTML = str;
+    }
+    else {
+      console.error("Hiba: readDiv nem található az oldalon!");
+    }
+
+    let count = list.length;
+    let avg = count > 0 ? (sum / count).toFixed(2) : 0;
+
+    document.getElementById("sumHeight").innerText = sum;
+    document.getElementById("avgHeight").innerText = avg;
+    document.getElementById("maxHeight").innerText = max;
+
+  } catch (error) {
+    console.error("Hiba az API hívás során:", error);
+  }
+}
+
+async function create() {
+  let nameStr = document.getElementById("name1").value;
+  if (nameStr == "" || nameStr.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás név!";
+    return;
+  }
+
+  let height = document.getElementById("height1").value;
+  if (height == "" || height.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás magasság!";
+    return;
+  }
+
+  let weight = document.getElementById("weight1").value;
+  if (weight == "" || weight.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás súly!";
+    return;
+  }
+
+  let response = await fetch(url, {
+    method: 'post',
+    cache: 'no-cache',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    body: "code=" + code + "&op=create&name=" + nameStr + "&height=" + height + "&weight=" + weight
+  });
+
+  let data = await response.text();
+  if (data > 0) {
+    str = "Sikeresen létrehozva";
+  }
+  else {
+    str = "Létrehozás sikertelen!";
+    return;
+  }
+
+  document.getElementById("createResult").innerHTML = str;
+  document.getElementById("name1").value = "";
+  document.getElementById("height1").value = "";
+  document.getElementById("weight1").value = "";
+  read();
+}
+
+async function getDataForId() {
+  let id = document.getElementById("idUpd").value;
+  if (id == "") {  //filter needless API calls
+    return;
+  }
+
+  let response = await fetch(url, {
+    method: 'post',
+    cache: 'no-cache',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    body: "code=" + code + "&op=read"
+  });
+
+  let data = await response.text();
+  let parsed_data = null;
+  try {
+    parsed_data = JSON.parse(data);
+  } catch (jsonError) {
+    console.error("Hiba: A válasz nem JSON formátumú!", data);
+    return;
+  }
+  for (let i = 0; i < parsed_data.list.length; i++)
+    if (parsed_data.list[i].id == id) {
+      document.getElementById("name2").value = parsed_data.list[i].name;
+      document.getElementById("height2").value = parsed_data.list[i].height;
+      document.getElementById("weight2").value = parsed_data.list[i].weight;
+    }
+}
+
+async function update() {
+  id = document.getElementById("idUpd").value;
+  if (id == "") {
+    document.getElementById("updateResult").innerHTML = "ID megadása kötelező!";
+    return;
+  }
+
+  let nameStr = document.getElementById("name2").value;
+  if (nameStr == "" || nameStr.length > 30) {
+    document.getElementById("updateResult").innerHTML = "Hibás név!";
+    return;
+  }
+
+  let height = document.getElementById("height2").value;
+  if (height == "" || height.length > 30) {
+    document.getElementById("updateResult").innerHTML = "Hibás magasság!";
+    return;
+  }
+
+  let weight = document.getElementById("weight2").value;
+  if (weight == "" || weight.length > 30) {
+    document.getElementById("updateResult").innerHTML = "Hibás súly!";
+    return;
+  }
+
+  let response = await fetch(url, {
+    method: 'post',
+    cache: 'no-cache',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    body:
+      "code=" + code + "&op=update&id=" + id + "&name=" + nameStr + "&height=" + height + "&weight=" + weight
+  });
+
+  let data = await response.text();
+  if (data > 0) {
+    str = "Frissítés sikeres";
+  }
+  else {
+    str = "Frissítés sikertelen";
+    return;
+  }
+
+  document.getElementById("updateResult").innerHTML = str;
+  document.getElementById("idUpd").value = "";
+  document.getElementById("name2").value = "";
+  document.getElementById("height2").value = "";
+  document.getElementById("weight2").value = "";
+  read();
+}
+
+async function deleteF() {
+  id = document.getElementById("idDel").value;
+  if (id.length > 0 && id.length <= 30) {
+    let response = await fetch(url, {
+      method: 'post',
+      cache: 'no-cache',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+      body: "code=" + code + "&op=delete&id=" + id
+    });
+    let data = await response.text();
+    if (data > 0)
+      str = "Törlés sikeres";
+    else
+      str = "Törlés sikertelen!";
+    document.getElementById("deleteResult").innerHTML = str;
path: resources/5/ajax.js
user: login: markbozsoki
body: please rename "str" to "user_message"
created_at: 2025-03-23T21:00:02Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,223 @@
+const url = "http://gamf.nhely.hu/ajax2/";
+const code = "VE22CSabc123";
+document.getElementById("code").innerHTML = "code=" + code;
+
+async function read() {
+  try {
+    let response = await fetch(url, {
+      method: 'post',
+      cache: 'no-cache',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+      body: "code=" + code + "&op=read"
+    });
+    let data = await response.text();
+    try {
+      data = JSON.parse(data);
+    } catch (jsonError) {
+      console.error("Hiba: A válasz nem JSON formátumú!", data);
+      return;
+    }
+
+    let list = data.list;
+    let sum = 0;
+    let max = 0;
+
+    let str = "<h3>Adatok lekérése</h3>";
+    str += "<p>Rekordok száma: " + data.rowCount + "</p>";
+    str += "<p>Utolsó max " + data.maxNum + " records:</p>";
+    str += "<table><tr><th>id</th><th>\tname</th><th>height</th><th>weight</th><th>code</th></tr>";
+
+    for (let i = 0; i < list.length; i++) {
+      let height = parseFloat(list[i].height);
+      if (!isNaN(height)) {
+        sum += height;
+        if (height > max) {
+          max = height;
+        }
+      }
+      str += `<tr>
+              <td>${list[i].id}</td>
+              <td>${list[i].name}</td>
+              <td>${list[i].height}</td>
+              <td>${list[i].weight}</td>
+              <td>${list[i].code}</td>
+          </tr>`;
+    }
+    str += "</table>";
+
+    let readDiv = document.getElementById("readDiv");
+    if (readDiv) {
+      readDiv.innerHTML = str;
+    }
+    else {
+      console.error("Hiba: readDiv nem található az oldalon!");
+    }
+
+    let count = list.length;
+    let avg = count > 0 ? (sum / count).toFixed(2) : 0;
+
+    document.getElementById("sumHeight").innerText = sum;
+    document.getElementById("avgHeight").innerText = avg;
+    document.getElementById("maxHeight").innerText = max;
+
+  } catch (error) {
+    console.error("Hiba az API hívás során:", error);
+  }
+}
+
+async function create() {
+  let nameStr = document.getElementById("name1").value;
+  if (nameStr == "" || nameStr.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás név!";
+    return;
+  }
+
+  let height = document.getElementById("height1").value;
+  if (height == "" || height.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás magasság!";
+    return;
+  }
+
+  let weight = document.getElementById("weight1").value;
+  if (weight == "" || weight.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás súly!";
+    return;
+  }
+
+  let response = await fetch(url, {
+    method: 'post',
+    cache: 'no-cache',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    body: "code=" + code + "&op=create&name=" + nameStr + "&height=" + height + "&weight=" + weight
+  });
+
+  let data = await response.text();
+  if (data > 0) {
+    str = "Sikeresen létrehozva";
+  }
+  else {
+    str = "Létrehozás sikertelen!";
+    return;
+  }
+
+  document.getElementById("createResult").innerHTML = str;
+  document.getElementById("name1").value = "";
+  document.getElementById("height1").value = "";
+  document.getElementById("weight1").value = "";
+  read();
+}
+
+async function getDataForId() {
+  let id = document.getElementById("idUpd").value;
+  if (id == "") {  //filter needless API calls
+    return;
+  }
+
+  let response = await fetch(url, {
+    method: 'post',
+    cache: 'no-cache',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    body: "code=" + code + "&op=read"
+  });
+
+  let data = await response.text();
+  let parsed_data = null;
+  try {
+    parsed_data = JSON.parse(data);
+  } catch (jsonError) {
+    console.error("Hiba: A válasz nem JSON formátumú!", data);
+    return;
+  }
+  for (let i = 0; i < parsed_data.list.length; i++)
+    if (parsed_data.list[i].id == id) {
+      document.getElementById("name2").value = parsed_data.list[i].name;
+      document.getElementById("height2").value = parsed_data.list[i].height;
+      document.getElementById("weight2").value = parsed_data.list[i].weight;
+    }
+}
+
+async function update() {
+  id = document.getElementById("idUpd").value;
+  if (id == "") {
+    document.getElementById("updateResult").innerHTML = "ID megadása kötelező!";
+    return;
+  }
+
+  let nameStr = document.getElementById("name2").value;
+  if (nameStr == "" || nameStr.length > 30) {
+    document.getElementById("updateResult").innerHTML = "Hibás név!";
+    return;
+  }
+
+  let height = document.getElementById("height2").value;
+  if (height == "" || height.length > 30) {
+    document.getElementById("updateResult").innerHTML = "Hibás magasság!";
+    return;
+  }
+
+  let weight = document.getElementById("weight2").value;
+  if (weight == "" || weight.length > 30) {
+    document.getElementById("updateResult").innerHTML = "Hibás súly!";
+    return;
+  }
+
+  let response = await fetch(url, {
+    method: 'post',
+    cache: 'no-cache',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    body:
+      "code=" + code + "&op=update&id=" + id + "&name=" + nameStr + "&height=" + height + "&weight=" + weight
+  });
+
+  let data = await response.text();
+  if (data > 0) {
+    str = "Frissítés sikeres";
+  }
+  else {
+    str = "Frissítés sikertelen";
+    return;
+  }
+
+  document.getElementById("updateResult").innerHTML = str;
path: resources/5/ajax.js
user: login: markbozsoki
body: please rename "str" to "user_message"
created_at: 2025-03-23T21:00:29Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,223 @@
+const url = "http://gamf.nhely.hu/ajax2/";
+const code = "VE22CSabc123";
+document.getElementById("code").innerHTML = "code=" + code;
+
+async function read() {
+  try {
+    let response = await fetch(url, {
+      method: 'post',
+      cache: 'no-cache',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+      body: "code=" + code + "&op=read"
+    });
+    let data = await response.text();
+    try {
+      data = JSON.parse(data);
+    } catch (jsonError) {
+      console.error("Hiba: A válasz nem JSON formátumú!", data);
+      return;
+    }
+
+    let list = data.list;
+    let sum = 0;
+    let max = 0;
+
+    let str = "<h3>Adatok lekérése</h3>";
+    str += "<p>Rekordok száma: " + data.rowCount + "</p>";
+    str += "<p>Utolsó max " + data.maxNum + " records:</p>";
+    str += "<table><tr><th>id</th><th>\tname</th><th>height</th><th>weight</th><th>code</th></tr>";
+
+    for (let i = 0; i < list.length; i++) {
+      let height = parseFloat(list[i].height);
+      if (!isNaN(height)) {
+        sum += height;
+        if (height > max) {
+          max = height;
+        }
+      }
+      str += `<tr>
+              <td>${list[i].id}</td>
+              <td>${list[i].name}</td>
+              <td>${list[i].height}</td>
+              <td>${list[i].weight}</td>
+              <td>${list[i].code}</td>
+          </tr>`;
+    }
+    str += "</table>";
+
+    let readDiv = document.getElementById("readDiv");
+    if (readDiv) {
+      readDiv.innerHTML = str;
+    }
+    else {
+      console.error("Hiba: readDiv nem található az oldalon!");
+    }
+
+    let count = list.length;
+    let avg = count > 0 ? (sum / count).toFixed(2) : 0;
+
+    document.getElementById("sumHeight").innerText = sum;
+    document.getElementById("avgHeight").innerText = avg;
+    document.getElementById("maxHeight").innerText = max;
+
+  } catch (error) {
+    console.error("Hiba az API hívás során:", error);
+  }
+}
+
+async function create() {
+  let nameStr = document.getElementById("name1").value;
+  if (nameStr == "" || nameStr.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás név!";
+    return;
+  }
+
+  let height = document.getElementById("height1").value;
+  if (height == "" || height.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás magasság!";
+    return;
+  }
+
+  let weight = document.getElementById("weight1").value;
+  if (weight == "" || weight.length > 30) {
+    document.getElementById("createResult").innerHTML = "Hibás súly!";
+    return;
+  }
+
+  let response = await fetch(url, {
+    method: 'post',
+    cache: 'no-cache',
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    body: "code=" + code + "&op=create&name=" + nameStr + "&height=" + height + "&weight=" + weight
+  });
+
+  let data = await response.text();
+  if (data > 0) {
+    str = "Sikeresen létrehozva";
+  }
+  else {
+    str = "Létrehozás sikertelen!";
+    return;
+  }
+
+  document.getElementById("createResult").innerHTML = str;
path: resources/5/ajax.js
user: login: markbozsoki
body: please rename "str" to "user_message"
created_at: 2025-03-23T21:01:04Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,223 @@
+const url = "http://gamf.nhely.hu/ajax2/";
+const code = "VE22CSabc123";
+document.getElementById("code").innerHTML = "code=" + code;
+
+async function read() {
+  try {
+    let response = await fetch(url, {
+      method: 'post',
+      cache: 'no-cache',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+      body: "code=" + code + "&op=read"
+    });
+    let data = await response.text();
+    try {
+      data = JSON.parse(data);
+    } catch (jsonError) {
+      console.error("Hiba: A válasz nem JSON formátumú!", data);
+      return;
+    }
+
+    let list = data.list;
+    let sum = 0;
+    let max = 0;
+
+    let str = "<h3>Adatok lekérése</h3>";
+    str += "<p>Rekordok száma: " + data.rowCount + "</p>";
+    str += "<p>Utolsó max " + data.maxNum + " records:</p>";
+    str += "<table><tr><th>id</th><th>\tname</th><th>height</th><th>weight</th><th>code</th></tr>";
+
+    for (let i = 0; i < list.length; i++) {
+      let height = parseFloat(list[i].height);
+      if (!isNaN(height)) {
+        sum += height;
+        if (height > max) {
+          max = height;
+        }
+      }
+      str += `<tr>
+              <td>${list[i].id}</td>
+              <td>${list[i].name}</td>
+              <td>${list[i].height}</td>
+              <td>${list[i].weight}</td>
+              <td>${list[i].code}</td>
+          </tr>`;
+    }
+    str += "</table>";
+
+    let readDiv = document.getElementById("readDiv");
+    if (readDiv) {
+      readDiv.innerHTML = str;
path: resources/5/ajax.js
user: login: markbozsoki
body: please rename "str" to "data_render_html"
created_at: 2025-03-23T21:03:32Z
author_association: OWNER
diff_hunk: @@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html lang="hu">
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Web-programozás-1 Előadás Házi feladat - AJAX</title>
+    <link type="text/css" rel="stylesheet" href="../main.css">
+    <link rel="stylesheet" href="style.css">
path: resources/5/ajax.html
user: login: MoSzabina
body: igazából a html5-ben már elavult a type, ezt a 4-ben használták, a rel="stylesheet" egyértelműsíti h css fájl. de legyen
created_at: 2025-03-24T09:21:39Z
author_association: COLLABORATOR

PR comments:
user: login: markbozsoki
created_at: 2025-03-23T16:11:10Z
body: Amit lát a felhasználó az legyen magyarul
author_association: OWNER
user: login: markbozsoki
created_at: 2025-03-23T21:07:34Z
body: Az ajax.html állományban amely input elemek szám formátumban várjék az értékeket, ott légyszives az input típusa is legyen "number".

GoodToHave: Legyen az "number" típusú input elemeken legalább egy `min="0"` beállíva, mivel senkinek sem lehet negatív magassága, tömege vagy id-ja
author_association: OWNER
user: login: markbozsoki
created_at: 2025-03-23T21:11:06Z
body: Majd ha megvannak a változtatások, kérlek formázd le a fájlokat, köszi
author_association: OWNER