aboutsummaryrefslogtreecommitdiffstats
path: root/csci4131/hw6/strap012_hw6/login.html
diff options
context:
space:
mode:
authorMatthew Strapp <msattr@gmail.com>2021-04-16 12:58:44 -0500
committerMatthew Strapp <msattr@gmail.com>2021-04-16 12:58:44 -0500
commit43865930f8580f6fe97ea9f54686a1b805358a6d (patch)
tree67a884ca82ab1c393baeb87059847fed7ff1cc03 /csci4131/hw6/strap012_hw6/login.html
parentI don't get Express routers (diff)
downloadhomework-43865930f8580f6fe97ea9f54686a1b805358a6d.tar
homework-43865930f8580f6fe97ea9f54686a1b805358a6d.tar.gz
homework-43865930f8580f6fe97ea9f54686a1b805358a6d.tar.bz2
homework-43865930f8580f6fe97ea9f54686a1b805358a6d.tar.lz
homework-43865930f8580f6fe97ea9f54686a1b805358a6d.tar.xz
homework-43865930f8580f6fe97ea9f54686a1b805358a6d.tar.zst
homework-43865930f8580f6fe97ea9f54686a1b805358a6d.zip
Get started on DB work, still needs much work
Diffstat (limited to '')
-rw-r--r--csci4131/hw6/strap012_hw6/login.html38
1 files changed, 38 insertions, 0 deletions
diff --git a/csci4131/hw6/strap012_hw6/login.html b/csci4131/hw6/strap012_hw6/login.html
new file mode 100644
index 0000000..59e7dfa
--- /dev/null
+++ b/csci4131/hw6/strap012_hw6/login.html
@@ -0,0 +1,38 @@
+<html>
+
+<head>
+ <script src="https://code.jquery.com/jquery-2.2.4.min.js"integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
+</head>
+
+<body>
+ <form id="myForm" name="myForm">
+ <div>
+ <label for="login">login:</label>
+ <input type="text" id="login" name="login" required>
+ </div>
+ <div>
+ <label for="password">password:</label>
+ <input id="password" name="password" type="password" required>
+ </div>
+ <input type="submit"value="Submit!">
+ </form>
+ <script>
+ $(document).ready(function () {
+ $('#myForm').submit(function (event) {
+ event.preventDefault();//collect the form data using Id Selector for whatever data you need to send to server
+ let login=$('#login').val();
+ let password=$('#password').val();
+ $.post('api/login',
+ {"login": login,"password": password},
+ (data) => {
+ console.log(data);
+ if(data.status === 'success'){
+ //pseudo code
+ //Make sure error message is not displayed
+ //Re-direct to contacts page,
+ window.location.href='contacts';}
+ else{
+ //Display error message
+ }});});});</script>
+
+</html>