验证邮箱是否合法

Original 2019-03-05 17:43:43 289
abstract:<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Ajax-注册验证</title> </head> <body> <p>邮箱: <input type=&
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Ajax-注册验证</title>
</head>
<body>
<p>邮箱: <input type="text"></p>
<p>密码: <input type="password"></p>
<p><button>提交</button></p>
</body>
<script type="text/javascript" src="js/jquery-3.3.1.js"></script>
<script type="text/javascript">
//当失去焦点时进行验证
$(':input').blur(function() {
$.ajax({
//请求
url: 'regsever.php',
//请求类型
type: 'GET',
//转化为json格式
data: $('form:first').serializeArray(),
//回调
success: function(msg, status, xhr) {
// console.log(msg)
$('p span').empty()
$('p').append($(msg)).css('font-size', '1.5em')
}
})
})
$('button:first').click(function() {
alert("恭喜您:注册成功!")
})
</script>
</html>


Correcting teacher:韦小宝Correction time:2019-03-06 09:14:13
Teacher's summary:ajax的验证还是蛮简单的 简单但是很重要 课后一定要多去练习哦

Release Notes

Popular Entries