<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function() {
//alert("hi");
$("button").click(function() {
$.get("content/helloajax.txt", function(data, status){
alert(status);
$("#cityname").html(data);
});
});
});
</script>
</head>
<body>
<h2 id="cityname"></h2>
<!--<p id="updatetime"></p>
<p id="wendu"></p>-->
<button>点我</button>
</body>
</html>
因为并没有学jQuery,所以这里只是对照着jQuery的文档写了一个小的案例。
网友评论