diff --git a/main.py b/main.py index 58fd4f58f8da0d7bd95d09918ab284f7a3469f21..b7cffb69b9489b14e647c952c6fbff0a352eb684 100644 --- a/main.py +++ b/main.py @@ -11,7 +11,7 @@ def Load(): Name = "CodeBase"; conn = sqlite3.connect(DATABASE) cur = conn.cursor() - cur.execute("SELECT * FROM coworking_spaces WHERE Name = 'CodeBase';") + cur.execute("SELECT * FROM 'coworking_spaces' WHERE Name =?;", [Name]) data = cur.fetchall() print(data) # cur.execute("SELECT Address FROM coworking_spaces WHERE Name =? ;", [Name]) @@ -26,9 +26,9 @@ def Load(): # Website = cur.fetchall() # cur.execute("SELECT Opening_Hours FROM coworking_spaces WHERE Name =? ;", [Name]) # Opening_Hours = cur.fetchall() - return render_template('Space.html', data = data) - return str(data) conn.close() + return render_template('Space.html', data = data) + diff --git a/static/spaces.js b/static/spaces.js new file mode 100644 index 0000000000000000000000000000000000000000..1c95d0b3e8c92931ac7a69d412b3bcdf3bfe3f80 --- /dev/null +++ b/static/spaces.js @@ -0,0 +1,17 @@ +function loadSpaceInfo() { + var xhttp = new XMLHttpRequest(); + xhttp.open("PUT", '/Load/CodeBase', true); + xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + xhttp.onreadystatechange = function() { + if (xhttp.readyState === 4 && xhttp.status === 200) { + console.log(xhttp.responseText); + // Below is the message to output onto the workspace page, + + document.getElementById("loadText").innerHTML = xhttp.responseText; + } else { +// console.error(`Status Text: ${xhttp.statusText}.`); +// console.error(`Ready State: ${xhttp.readyState}.`); + } + }; + xhttp.send(); +} diff --git a/static/testSearch.html b/static/testSearch.html index 1e51c2984be75e2ed33b144deace08a2032b0013..c650c9571f95d963737d8f77a5b7ac5834a448f9 100644 --- a/static/testSearch.html +++ b/static/testSearch.html @@ -8,4 +8,4 @@ <li><a href="/Load/CodeBase">view CodeBase</a></li> -</head +</header> diff --git a/templates/OurSpaces.html b/templates/OurSpaces.html index 218f8d279a43fe01866badee261002292617f336..8dced386d4b8dd2cffbb3bb8c2ee26ce70b619d0 100644 --- a/templates/OurSpaces.html +++ b/templates/OurSpaces.html @@ -1,4 +1,4 @@ -<head> + <head> <link rel="stylesheet" href="framework.css"> </head> @@ -27,11 +27,11 @@ </div> <div class="Image box"> -<img scr= {% block imageBlock%} {%endblock%}> +{% block imageBlock%}<img scr= >{%endblock%} </div> <div class="AddImage box"> -<img scr="{% block addimageBlock%} {%endblock%}"> +{% block addimageBlock%}<img scr=" ">{%endblock%} </div> <div class="times box"> diff --git a/templates/Space.html b/templates/Space.html index 62c24592f28bfa0e2a88cbe9a6925713d3b11a29..6714b6aa1dfecb99279c272031f18b4d9419fe32 100644 --- a/templates/Space.html +++ b/templates/Space.html @@ -4,9 +4,11 @@ <h1 id="name"></h1><br> <td>data</td> <img src= Main_Photo><br> -<<script type="text/javascript"> +<script type="text/javascript"> document.getElementById("name").innerHTML= data; </script> +<script defer src+"Space.js"></script> +<p id="loadText">temp text</p> <table border = 1> <thead> <td>Name</td>