http://www.w3school.com.cn/tiy/t.asp?f=jquery_ajax2
在sublime上实现一遍,无法改变内容。html、jquery-3.2.1.min.js、test1.txt都在桌面上
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>pratice</title>
<script src="jquery-3.2.1.min.js"></script>
<script>
$(document).ready(function(){
$("#b01").click(function(){
htmlobj=$.ajax({url:"test1.txt",async:false});
$("#myDiv").html(htmlobj.responseText);
})
});
</script>
</head>
<body>
<div id="myDiv"><h2>通过AJAX改变文本</h2></div>
<button id="b01" type="button">改变内容</button>
</body>
</html>```
![image.png](http://upload-images.jianshu.io/upload_images/316258-19962bdc2125bb64.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)