Jquery Ajax模版

$.ajax({
    type: "GET",
    url: "test.json",
    data: {username:'tt', content:'tt'},
    dataType: "json",
    success: function(data){                
             var html = ''; 
             $.each(data, function(commentIndex, comment){
                   html += '<div class="comment"><h6>' + comment['username']
                             + ':</h6><p class="para"' + comment['content']
                             + '</p></div>';
             });
             $('#resText').html(html);
          }
});

 

posted @ 2019-04-10 16:57  WhoAmMe  阅读(300)  评论(0编辑  收藏  举报