日期:2014-05-16 浏览次数:20400 次
<html> <head> <meta http-equiv="content-type" content="text" charset="gb2312" /> <script type="text/javascript" src="/jquery/jquery.js"></script> </script> </head> <body> <input type="button" id="send" value="Ajax获取" /> <div id="resText">内容替换</div> <script type="text/javascript"><!-- $(document).ready(function(){ $("#send").click(function(){ $("#resText").load("test.php", {name:"andy"}); }); // --></script> </body> </html>code] 被加载的文件:test.php [code=PHP]<?php $name = $_POST['name']; echo $name; $s = $_GET['name']; echo $name; ?> hello world!
$("#resText").load("test.php", {"name":"andy"});