日期:2014-05-16 浏览次数:20759 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>ajax test</title> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $(function(){ $('button').click(function(){ $name = $(this).attr('name'); $('#out').empty().load('test1.php',{ name : $name }); }); }); </script> <style type="text/css"></style> </head> <body> <button id="btn-1" name="1">1</button> <button id="btn-2" name="2">2</button> <button id="btn-3" name="3">3</button> <div id="out"></div> </body> </html>
?
<?php switch($_POST['name']){ case 1: echo '1 哈哈'; break; case 2: echo '2 呵呵'; break; case 3: echo '3 活活'; break; } ?>
?