码迷,mamicode.com
首页 > Web开发 > 详细

jQuery demo

时间:2016-05-16 17:09:05      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:

 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title></title>
 6 </head>
 7 <body>
 8     <!--<input id="n1" name="pp"/>-->
 9     <input type="button" value="sub" onclick="SubmitData();" />
10     <div id="con">
11 
12     </div>
13 
14 
15     <script src="jquery-2.2.3.min.js"></script>
16     <script>
17         function SubmitData(){
18 //            var inpVal = $(‘#n1‘).val();
19 //            var inpName = $(‘#n1‘).attr(‘name‘);
20 
21             $.ajax({
22                 url:"http://www.jxntv.cn/data/jmd-jxtv2.html",
23 //                data: {‘kk‘:123,inpName:inpVal},
24                 data:{},
25                 type:GET,
26                 dataType: jsonp,
27                 jsonpCallback: list,
28                 success:function(arg){
29                     console.log(arg);
30                     var jsonpArray = arg.data;
31                     $.each(jsonpArray,function(k,v){
32                         var week = v.week;
33                         var temp = "<h1>" + week + "</h1>";
34                         $(#con).append(temp);
35                         var listArray = v.list;
36                         $.each(listArray,function(kk,vv){
37                             var link = vv.link;
38                             var name = vv.name;
39 
40                             var tempNew = "<a href=" + link + ">" + name + "</a><br>"
41                             $(#con).append(tempNew)
42                         })
43                     })
44                 },
45                 error:function(){
46 
47                 }
48             })
49         }
50     </script>
51 </body>
52 </html>

 

jQuery demo

标签:

原文地址:http://www.cnblogs.com/dribs/p/5498614.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!