Blogger Information
Blog 28
fans 0
comment 0
visits 14282
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
$.ajax()用法--2018年4月11日0点22分上传
泰礴松的博客
Original
442 people have browsed it

学习越来越难,对于零基础的我来说,真的很吃力,有的时候就是在这硬撑,本次作业是$.ajax()的完整用法

实例

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>3.$.ajax()</title>
</head>
<body>
	<h2>用户登录</h2>
	<form>
		<p>用户名:<input type="text" name="name"></p>
	</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>

运行实例 »

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

php引用的是老师的代码

手写版

1916593856.jpg

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