Vote count:
0
I used to be able to log in with the following code to a url. It alerts me if the log in details are wrong or logs me in when it is correct.
The url changed slightly and right now, I am not able to log in. Not even get the alert message saying I wrong input. Nothing happens.
Old url where it was working fine: http://ift.tt/1p7TNh1
new url where nothing happens: http://ift.tt/1jw0TwE
Rank is always going to be a same number(22 is just an example) thus I dun want the user to have to input that too. I just added an input for rank too just to test if that is the issue but the problem persists.
If I directly input the url with the log in details to a browser, it works.
I don't get what went wrong considering the codes were working fine prior to the url change. Please advice. Thank you.
<html>
<script>
$(document).on("pageinit", "#loginForm", function () {
$("#form1").on("submit", function (event) {
event.preventDefault();
$.ajax({
type: "GET",
url: "http://ift.tt/Ny1Jdx",
data: $("#form1").serialize(),
success: function (data) {
console.log(data);
if (data.loggedIn) {
$.mobile.changePage("#home");
} else {
alert("You entered the wrong username or password. Please try again.");
}
}
});
});
});
</script>
<form id="form1" name="form1" method="GET" action="http://ift.tt/Ny1Jdx">
<label for="id">Username </label>
<input type="text" name="id" id="id" />
<label for="password">Password </label>
<input type="password" name="password" id="password" />
<label for="rank">Rank </label>
<input type="rank" name="rank" id="rank" />
<input type="submit" name="submit" value="Login"/>
</form>
</html>
Aucun commentaire:
Enregistrer un commentaire