Answer the question
In order to leave comments, you need to log in
Why does js script not work in mobile browser?
the script does not work in a mobile browser, on ios in any browser and on android in UcBrowse,
$.ajax({
type: "POST",
url: "/auth/",
data: {
"login" : $("input[name=login").val(),
"password" : $("input[name=password").val()
},
success: function(data){
console.log(data);
if(data.error_password){
var error = '<span style="color:red">Не правильный логин или пароль!</span>';
$("#message").html(error).hide().fadeIn();
setTimeout(function(){$("#message").fadeOut();}, 3000);
}else if(data.success){
jQuery(location).prop('href', '/');
}
}
});
<html>
<head>
<meta charset="UTF-8">
<title>Авторизация</title>
<link rel="stylesheet" href="/assets/login/css/style.css" media="screen" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="/assets/login/js.js"></script>
</head>
<body>
<h1>Авторизация</h1>
<input type="text" name="login" placeholder="Логин">
<input type="password" name="password" placeholder="Пароль">
<a href="#" onclick="login()"> ВОЙТИ</a>
<span id="message" style="display:none;"></span>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question