From eca4c4179ce619b0a902054b2ebb481a55d3b350 Mon Sep 17 00:00:00 2001 From: Jasmin <2211581@stud.hs-mannheim.de> Date: Tue, 13 Jun 2023 12:22:38 +0200 Subject: [PATCH] =?UTF-8?q?Warenkorb=20Symbol=20f=C3=BCgt=20das=20Buch=20z?= =?UTF-8?q?um=20Warenkorb=20hinzu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buch_details.php | 32 +++++++++++++++++++++++++++++++- buecher.php | 27 ++++++++++++++++++++++++++- suchergebnisse.php | 32 ++++++++++++++++++++++++++++---- 3 files changed, 85 insertions(+), 6 deletions(-) diff --git a/buch_details.php b/buch_details.php index 48905eb..c02845f 100644 --- a/buch_details.php +++ b/buch_details.php @@ -168,7 +168,10 @@ -
+ +
@@ -200,6 +203,33 @@ + + + + + +
"; @@ -182,6 +185,28 @@ data.toString(); location.href = url; } + + function addBookToCart(ID) { + // OnClick Event für open_bookDetails stoppen + if (!e) var e = window.event; + e.cancelBubble = true; + if (e.stopPropagation) e.stopPropagation(); + + // ID abtrennen + ID = ID.replace('shoppingCart', ''); + alert(ID); + + var request = new XMLHttpRequest(); + request.open('POST', + 'http://141.19.142.11/warenkorb_funktionen.php', true); + // TODO: Handler erstellen + request.onload = function() { + console.log(this.responseText); + } + request.setRequestHeader('Content-type', + 'application/x-www-form-urlencoded'); + request.send(`function=addBookToCart&id=${ID}`); + } diff --git a/suchergebnisse.php b/suchergebnisse.php index f71bd35..1c2e397 100644 --- a/suchergebnisse.php +++ b/suchergebnisse.php @@ -188,7 +188,7 @@ if ($counter != 0) { echo "
"; } - // TODO: OnClick auslagern. + // TODO: OnClick Event auslagern echo "
@@ -231,7 +231,10 @@
-
+ +
"; @@ -253,16 +256,37 @@ - +