批改状态:合格
老师批语:
$ajax() 方法的演示:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>$.ajax()</title>
</head>
<body>
<h2>用户登录</h2>
<form>
<p>用户名:<input type="text" name="name"></p>
<p>密码:<input type= "password" name="pass"></p>
<input type="submit" value="提交" >
<input type="reset" valute="重置">
</form>
</body>
</html>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$(':input').blur(function(){
$.ajax({
url: 'api/demo.php',
type: 'GET',
data: $('form:first').serializeArray(),
success: function(msg,status,xhr) {
console.log(msg)
$('p span').empty()
$('p').append($(msg))
}
})
})
</script>点击 "运行实例" 按钮查看在线实例
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号