Blogger Information
Blog 18
fans 0
comment 0
visits 9782
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
第18章 4_10ajax和bootstrap-作业
唐朝的博客
Original
469 people have browsed it

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>ajax()注册提交</title>
</head>
<body>
	<h2>用户注册</h2>
	<p>账号
		<input type="text" name="name" id="name">
		<span></span>
	</p>
	<p>密码
		<input type="password" name="password">
	</p>
	<button>提交</button>
</body>
</html>

<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript">
	$('#name').blur(function() {
		$.ajax({
			url: 'api/info.php',
			type: 'GET',
			async: true,
			data: {'name': $('#name').val()},
			success: function(msg, status, xhr){
				$('p span').empty();
				$('p span').append($(msg));
			}
		})
	})
	
</script>

运行实例 »

点击 "运行实例" 按钮查看在线实例


Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!