使用ajax的responseText属性获取后台获得字符串形式的响应数据。

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#b01").click(function() {
htmlobj = $.ajax({
url : "/kjmfl",
async : false
});
$("#myDiv").html(htmlobj.responseText);
});
});
</script>
</head>
<body>
<button id="b01" type="button"></button>
</body>

</html>




猜你喜欢

转载自blog.csdn.net/qq_35568099/article/details/80176293