jQuery demo
2016-05-16 16:47 dribs 阅读(197) 评论(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>