标签:style class blog code java ext
1 $.ajax({ 2 url:"result.php", 3 //data:{"page":i}, 4 dataType:"json", 5 beforeSend:function(){ 6 $("#load").append("<div id=‘loading‘><img src=‘loading.gif‘></div>"); 7 }, 8 success:function(json){ 9 if(json){ 10 $("#load").empty(); 11 //alert(111); 12 var str = ""; 13 $.each(json,function(index,array){ 14 //alert(json); 15 //var str = "<div class=\"single_item\"><div class=\"element_head\">"; 16 str += "<div class=‘author‘>"+array[‘author‘]+"</div>"; 17 str += "<div class=\"date\">"+array[‘date‘]+"</div>"; 18 str += "<div class=\"title\ >"+array[‘title‘]+"</div>"; 19 str += "<div class=\"more\"><a href=‘javascript:void(0)‘>more>></a></div><br>"; 20 str += "<div class=‘content‘>"+array[‘content‘]+"</div><br><hr>"; 21 22 $(".content").each(function(){ 23 if($(this).text().length>100){ 24 $(this).text($(this).text().substring(0,100)); 25 $(this).html($(this).html()+‘...‘); 26 } 27 }) 28 29 $("#container").append(str); 30 }); 31 } 32 } 33 });
ajax无刷新获取php后台数据,布布扣,bubuko.com
标签:style class blog code java ext
原文地址:http://www.cnblogs.com/mrcln/p/3791906.html