Script to verify data in an array and then takes you to another page?

50 views Asked by At

I am doing a logging system with a function that verifies the data of an array, but I would like that after that once the correct data is entered it takes you to another page. Here is the first part of my script.

var objUsers = [
  {
    username: "vocal",
    password: "xp20yz"
  },
  {
    username: "admin",
    password: "portilla"
  }
]
function getLogin() {
  var username = document.getElementById("username").value
  var password = document.getElementById("password").value
  
  for(i = 0; i < objUsers.length; i++){
    if(username == objUsers[i].username && password == objUsers[i].password)
  {
    console.log(username + " Estás dentro ")
    return
  }
  console.log("Datos incorrectos")
}
}

Please help me!

0

There are 0 answers