demo.php
<?php
$name = $_POST["name"];
$website = $_POST["website"];
echo "$name 的网站是:$website";
?>
demo.html
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
</head>
<body>
<button>POST 方式获取数据</button>
<script type="text/javascript" src="jquery-1.10.1.min.js"></script>
<script>
$(function() {
$("button").click(function() {
$.post("demo.php", {
name: "chaoyi",
website: "onestopweb.iteye.com"
},function(data, status) {
alert("数据:" + data + "\n状态:" + status);
});
});
});
</script>
</body>
</html>
效果图: