JQuery_AJAX简单笔记

 

上代码:

 1  <script type="text/javascript">
 2 
 3         //Ajax方法
 4               $.ajax({
 5                    type: "post",
 6                    cache: false,       
 7                    url: "Handler1.ashx",
 8                    data: "name=小明&age=13",
 9                    success: function f(e) {
10                        $("#btn").click(function () { 
11                             alert(e)
12                         })
13                     }
14                 });
15 
16 
17 //        //post和get方法一样用法
18         $(function () {
19             $.ajaxSetup({
20             cache:false
21             })
22             $("#btn").click(function () {
23                 $.get("Handler1.ashx", { "name": "小红", "age": "18" }, function (e) {
24                     alert(e);
25                 })
26                 //load  载入远程 HTML 文件代码并插入至 DOM 中。
27                 $("#d").load("Handler1.ashx", { "name": "小红", "age": "18" })
28             })
29 
30            
31 
32         })
33 
34        
35        
36     </script>

 

posted @ 2016-06-05 13:58  oldmonk  阅读(207)  评论(0编辑  收藏  举报
Fork me on GitHub