本文共 1231 字,大约阅读时间需要 4 分钟。
HTML代码:
---------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns=""> <head> <title> TEST </title> <meta name="generator" content="editplus" /> <meta name="author" content="" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <script type="text/javascript" src="jquery-1.2.6.pack.js"></script> <script type="text/javascript"> <!-- $(document).ready( function () { $('#btn').click ( function () { $.ajax({ url: 'http://localhost/1.php', type: 'POST', data:'name='+$('#name').val(), dataType: 'html', timeout: 1000, error: function(){ alert('Error loading XML document'); }, success: function(html){ $('#text').html(html); } }); }); }) //--> </script> </head><body>
<div id="text"></div> <input type="text" id="name" name="name" /> <input type="button" value="DO IT ." id="btn"/> </body> </html>---------------------------------------------------------------------------
1.PHP代码
---------------------------------------------------------------------------
<?php
$name = $_POST['name']; echo "you say : ".$name;?>
本文转自黄聪博客园博客,原文链接:http://www.cnblogs.com/huangcong/archive/2011/04/08/2009638.html,如需转载请自行联系原作者