This commit is contained in:
Leo 2024-01-21 14:31:45 +08:00
commit 638993a66a
9 changed files with 26 additions and 9 deletions

View File

@ -9,7 +9,7 @@ i repeat DO NOT USE CREDS IN CODE! Please use .env files (https://www.npmjs.com/
1) Ti Seng 1) Ti Seng
* Webserver Microservices * Webserver Microservices
* IoT sensor * IoT sensor
* All Database / Backend Functions * Most Database / Backend Functions of this repo
* consumer website api and user function * consumer website api and user function
2) Sean 2) Sean
* Admin Website Microservice * Admin Website Microservice

View File

@ -256,7 +256,7 @@ app.auth = (function (app) {
}; };
})(app); })(app);
//ajax form submit //ajax form submit and pass to api
function formAJAX(btn, del) { function formAJAX(btn, del) {
event.preventDefault(); // avoid to execute the actual submit of the form. event.preventDefault(); // avoid to execute the actual submit of the form.
var $form = $(btn).closest("[action]"); // gets the 'form' parent var $form = $(btn).closest("[action]"); // gets the 'form' parent

View File

@ -51,11 +51,27 @@ router.get('/news', function(req, res, next) {
res.render('news'); res.render('news');
}); });
//learn more page
router.get('/learnmore', function(req, res, next) {
res.render('learnmore');
});
//login | register page //login | register page
router.get('/login', function(req, res, next) { router.get('/login', function(req, res, next) {
res.render('signuplogin'); res.render('signuplogin');
}); });
//profile page
router.get('/profile', function(req, res, next) {
res.render('profile');
});
//forgot password page
router.get('/forgotPassword', function(req, res, next) {
res.render('forgotPassword');
});
//contact page //contact page
router.get('/contact', function(req, res, next) { router.get('/contact', function(req, res, next) {
res.render('contact'); res.render('contact');

View File

@ -85,6 +85,9 @@
<!-- Bootstrap core JavaScript --> <!-- Bootstrap core JavaScript -->
<script src="vendor/jquery/jquery.min.js"></script> <script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script> <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="js/learnmore.js"></script>
<script src="js/contact.js"></script>
<script src="js/search.js"></script>
<script src="js/api.js"></script> <script src="js/api.js"></script>
<script src="js/learnmore.js"></script> <script src="js/learnmore.js"></script>
<script src="js/search.js"></script> <script src="js/search.js"></script>

View File

@ -1,6 +1,5 @@
<%- include('top') %> <%- include('top') %>
<br> <br>
<br> <br>

View File

@ -26,7 +26,6 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;1,300&family=Source+Code+Pro:wght@300&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;1,300&family=Source+Code+Pro:wght@300&display=swap" rel="stylesheet">
<!-- jQuery library --> <!-- jQuery library -->
<script src="https://code.jquery.com/jquery-3.7.1.min.js" <script src="https://code.jquery.com/jquery-3.7.1.min.js"
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script> integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
@ -112,6 +111,8 @@
</div> </div>
</div> </div>
</nav> </nav>
</body> </body>
</html> </html>

View File

@ -24,17 +24,15 @@ document.addEventListener('DOMContentLoaded', () => {
const result = await response.json(); const result = await response.json();
// Handle the API response // Handle the API response
//console.log(result); console.log(result);
if (result.success) { if (result.success) {
// Form submitted successfully, display notification // Form submitted successfully, display notification
alert('Form submitted successfully!'); alert('Form submitted successfully!');
location.reload() location.reload()
// You can replace the alert with your custom notification logic
} else { } else {
// Form submission failed, display error notification // Form submission failed, display error notification
alert('Form submission failed. Please try again.'); alert('Form submission failed. Please try again.');
// You can replace the alert with your custom error notification logic
} }
} catch (error) { } catch (error) {