added stuff in pair programming session

This commit is contained in:
StockiP
2022-04-29 16:49:07 +02:00
parent c2789efcdc
commit cefac0c252
10 changed files with 179 additions and 16 deletions

11
js/app.js Normal file
View File

@@ -0,0 +1,11 @@
"use strict";
$(document).ready(function () {
$('#top_nav_bar').load('../components/top_nav.html');
$('#main_nav_bar').load('../components/main_nav.html');
$('#mmlcarousel').load('../components/banner.html');
$('#mmlMainContent').load('../components/ftProducts.html');
$('#marmeladenladen_footer').load('../components/footer.html');
$('#marmeladenladen_search').load('../components/modal.html');
$('#marmeladenladenLogin').load('../components/loginModal.html');
$('#marmeladenladenRegister').load('../components/registerModal.html');
});

28
js/registration.js Normal file
View File

@@ -0,0 +1,28 @@
const email = document.getElementById('email');
const password = document.getElementById('password');
const password2 = document.getElementById('password2');
password2.addEventListener('change', checkPassword);
function register() {
if (!checkPassword()) {
return;
}
const form = document.querySelector('#marmeladenLadenRegisterForm');
var formData = new FormData(form);
const jSONdata = JSON.stringify(Object.fromEntries(formData));
//print elements of jSONdata
console.log(jSONdata);
}
function checkPassword() {
if (password.value != password2.value) {
password2.setCustomValidity('Passwords do not match');
return false;
} else {
password2.setCustomValidity('');
return true;
}
}