Hello i'm trying to do a login form query code that valides if my username and password is entered correctly with the username and password: New_Username and 123456789,i tried with php but for some reason the php code doesn't work in VS code code:
$(document).ready(function () {
$("#login").click(function () {
var email = $("#email").val();
var password = $("#password").val();
// Checking for blank fields.
if (email == '' || password == '') {
$('input[type="text"],input[type="password"]').css("border", "2px solid red");
$('input[type="text"],input[type="password"]').css("box-shadow", "0 0 3px red");
alert("Please fill all fields...!!!!!!");
} else {
$.post("login.php", {
Username: New_Username,
password1: 123456789
},
function (data) {
if (data == 'Invalid Email.......') {
$('input[type="text"]').css({
"border": "2px solid red",
"box-shadow": "0 0 3px red"
});
$('input[type="password"]').css({
"border": "2px solid #00F5FF",
"box-shadow": "0 0 5px #00F5FF"
});
alert(data);
} else if (data == 'Email or Password is wrong...!!!!') {
$('input[type="text"],input[type="password"]').css({
"border": "2px solid red",
"box-shadow": "0 0 3px red"
});
alert(data);
} else if (data == 'Successfully Logged in...') {
$("form")[0].reset();
$('input[type="text"],input[type="password"]').css({
"border": "2px solid #00F5FF",
"box-shadow": "0 0 5px #00F5FF"
});
alert(data);
} else {
alert(data);
}
});
}
});
});
is this the good code for login form query that i mentioned it gives an error saying "dom.js:1 Uncaught ReferenceError: $ is not defined at dom.js:1",also the login form and validation not working how i fix this error and code?