AJAX的使用案例

 1 $.ajax({
 2          **//表示请求是否异步处理。默认是 true,  true  or false**
 3          async:true,
 4          **//规定请求的类型(GET 或 POST)**
 5          type: 'get',
 6          **//规定发送请求的 URL。默认是当前页面。**
 7          url:"demo_test.txt",
 8          **//发送数据到服务器时所使用的内容类型。默认是:"application/x-www-form-urlencoded"**
 9          contentType:'application/x-www-form-urlencoded',
10          **//规定要发送到服务器的数据**
11          data:{  name : 'name',password:'password'},
12          **//预期的服务器响应的数据类型。**
13         dataType:'application/x-www-form-urlencoded',
14         **//当请求成功时运行的函数**
15          success:function(result){
16         $("#div1").html(result);
17           },
18           **//如果请求失败要运行的函数**
19           error:function(err){
20           },
21     });

稍后更新ajax更详细的知识点

原文地址:https://www.cnblogs.com/itjunjun/p/12909413.html