<!DOCTYPE html>
<html>
<head>
<script src="jquery.js">
</script>
<script>
$(document).ready(function(){
$("#btn1").click(function(){
$.get("uploads/get.txt",function(data,status){
alert("数据:"+data+"\n状态"+status);
});
});
$("#btn2").click(function(){
$.post("uploads/post.txt",
{
name:"Dnoald Duck",
city:"Duckburg"
},
function(data,status){
alert("数据:"+data+"\n状态"+status);
});
});
});
</script>
</head>
<body>
<button id="btn1">向页面发送HTTP GET 请求,然后获得返回结果</button>
<button id="btn2">向页面发送HTTP POST 请求,然后获得返回结果</button>
</body>
</html>
<html>
<head>
<script src="jquery.js">
</script>
<script>
$(document).ready(function(){
$("#btn1").click(function(){
$.get("uploads/get.txt",function(data,status){
alert("数据:"+data+"\n状态"+status);
});
});
$("#btn2").click(function(){
$.post("uploads/post.txt",
{
name:"Dnoald Duck",
city:"Duckburg"
},
function(data,status){
alert("数据:"+data+"\n状态"+status);
});
});
});
</script>
</head>
<body>
<button id="btn1">向页面发送HTTP GET 请求,然后获得返回结果</button>
<button id="btn2">向页面发送HTTP POST 请求,然后获得返回结果</button>
</body>
</html>