$.ajax({ type : "post", async:false, url : "http://localhost:8080/getArticle.do", data:{}, dataType : "jsonp", jsonp: "callback", success : function(data){ var panelStart = "<div class=\"panel panel-default\">"; var headStart = "<div class=\"panel-heading\">"; var bodyStart = "<div class=\"panel-body\">"; var end = "</div>"; var i = 0; var len = data.length; while(i < len){ console.log(data[i]); var articleTitle = data[i].title; var articleContent = data[i].content; var content = panelStart + headStart + articleTitle + end + bodyStart + articleContent + end + end; console.log(content); console.log($(content)); $("#article-list").append($(content)); i++; }
test
最新推荐文章于 2023-03-29 22:15:44 发布