<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>this is a test</title>
</head>
<body>
<script type="text/javascript" src="/fire_ant_project/editor/jquery.min.js"></script>
<script>
$.ajax({
url:"http://localhost:808/文章/article/getArticle",
type:"post",
contentType : 'application/json;charset=UTF-8',
dataType: "json",
success:function(results){
console.log(results.data[0].content);
//通过这个方法就实现了html标签读取,替换body,results.data[0].content为html标签内容
$(document.body).html(results.data[0].content);
}
})
</script>
</body>
</html>
html把从接口获取的HTML标签读取并显示
于 2022-01-24 17:07:28 首次发布