when i press on the signup button it stores the data and make everything except redirecting to other page instead it give ?# in the path of my browser
`function login() {
let password = document.querySelector(“.password”).value;
let email = document.querySelector(“.email”).value;
let user_records = new Array()
user_records = JSON.parse(localStorage.getItem("users")) ? JSON.parse(localStorage.getItem("users")) : []
if (user_records.some((v)=> {
return v.email == email && v.password == password
}
)) {
let currrent_user = user_records.filter((v) => {
return v.email == email && v.password == password
})[0]
localStorage.setItem("email", currrent_user.email)
localStorage.setItem("password",currrent_user.password)
localStorage.setItem('isLoggedIn', true)
localStorage.setItem("name", currrent_user.firstName);
localStorage.setItem("phone",currrent_user.phone)
window.location.href = "/main2.html"
//not wwrking
}
else {
alert("login failed")
localStorage.setItem('isLoggedIn', false)
}
}`
have tried everything including window.location.replace() my main2.html is in the same folder
i think that the ?# that appears at the end of the path makes this problem
1