From 0c7bb17b8c955254c2db61a5fe9c8240ea1357e2 Mon Sep 17 00:00:00 2001 From: Matthew Strapp Date: Fri, 16 Apr 2021 21:37:26 -0500 Subject: finish hw6 --- csci4131/hw6/strap012_hw6/login.html | 46 ++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 18 deletions(-) (limited to 'csci4131/hw6/strap012_hw6/login.html') diff --git a/csci4131/hw6/strap012_hw6/login.html b/csci4131/hw6/strap012_hw6/login.html index 59e7dfa..9bb80cc 100644 --- a/csci4131/hw6/strap012_hw6/login.html +++ b/csci4131/hw6/strap012_hw6/login.html @@ -1,11 +1,17 @@ + + -
+
+

Login Page

+
+

+
@@ -16,23 +22,27 @@
+
+ //jQuery below. Tread with caution as sneezing near here may rupture the fabric of reality. + $(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) => { + 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 + $('#error').html("Login failed. Please try again.") + }}); + }); + }); -- cgit v1.2.3