jquery GET POST

时间:2025-01-30 21:05:20

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<head>

<!--引入百度库-->

<script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js">

</script>

<title></title>

<script>

$(document).ready(function(){

$("#btn1").click(function(){

$.get("/try/ajax/demo_test.php",function(data,status){

alert("数据: " + data + "\n状态: " + status);

});

});

});

$("#btn1").click(function(){

$.post("/try/ajax/demo_test_post.php",{

name:"菜鸟教程",

url:"http://www.runoob.com"

},

function(data,status){

alert("数据: \n" + data + "\n状态: " + status);

});

});

</script>

</head>

<body>

<button id="btn1">添加文本</button>

</body>

</html>