Hi everyone!
I’m using window.location = “” to link to another html page when a user have entered correctly username and password but it doesn’t work.
I also tried
window.open() – this work well, but I don’t want it to open a new tab,
window.location.assign(), window.location.href = “” and window.open("" , “_self”) but nothing work.
All I got when I click on login button is the old URL and the question mark behind like this “file:///Users/thotran/Desktop/Programming/HTML/MU-logga-in.html?”
This is my code
$(".login").click(function () {
var userID = $(".username").val();
var pass = $(".password").val();
if (userID == users.login.username && pass == users.login.password){
function confirmation() {
var answer = confirm("Vill du får mer information om kurserna?")
if (answer){
// window.open('../HTML/MU-kursinfo.html');
// window.location.assign('../HTML/MU-kursinfo.html');
// window.location.href = '../HTML/MU-kursinfo.html';
// window.location = "../HTML/MU-kursinfo.html";
// window.location("../HTML/MU-kursinfo.html");
// window.open("../HTML/MU-kursinfo.html","_self");
window.location = ("MU-kursinfo.html");
window.confirm = function() {};
window.alert = function() {};
}
}
confirmation();
}
else if (userID != '' && pass != ''){
alert('Fel användarnamn och/eller lösenord! Testa igen!');
window.alert = function() {};
window.confirm = function() {};
}
});
What am I doing wrong?
Grateful for help!