<!doctype html><html lang="en"> <head> <meta charset="UTF-8"> <title>ajax()</title> <script src="js/jquery-1.6.js"></script> <script> $(function(){ $(
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ajax()</title>
<script src="js/jquery-1.6.js"></script>
<script>
$(function(){
$("#btn").click(function(){
var json={name:"zhangwuji",pwd:12345}
$.ajax({
type:"POST",
url:"03.php",
data:json,
success:function(data,textStatus){
console.log(data);
console.log(textStatus);
}
});
})
});
</script>
<style>
</style>
</head>
<body>
<input type="button" id="btn" value="ajax方法">
</body>
</html>
03.php:
<?php
$name=$_REQUEST['name'];
$pwd=$_REQUEST['pwd'];
echo $name.':'.$pwd;
?>