如图,如果我先点击1,那么会提示1;
之后不刷洗,再点击2,应该是只提示2,但是会还提示1……
不刷新,再点击3,却还有提示1,2……以此类推
HTML代码:
复制代码
- <!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" xml:lang="zh" lang="zh" dir="ltr">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta name="generator" content="" />
- <meta name="keywords" content="" />
- <meta name="description" content="" />
- <meta name="author" content="" />
- <!--
- <script type="text/javascript" src="js/common.js"></script>
- <link rel="stylesheet" type="text/css" href="css/style.css" />
- -->
- <link rel="shortcut icon" href="images/favicon.ico" />
- <script type="text/javascript" src="./jquery-1.3.2.js"></script>
- <script type="text/javascript" src="./jquery.blockUI.js"></script>
- <script type="text/javascript">
- $(document).ready(function() {
- $("a").click(function() {
- var aId = this.id;
- alert(aId);
- $.blockUI({
- message: $('#confirmForm')
- });
- $("input[name='cancel_btn']").click(function() {
- $.unblockUI();
- });
- $("input[name='confirm_btn']").click(function() {
- alert("ajax发送:" + aId);
- $.unblockUI();
- $.get("ajaxbug.php", {aId:aId}, function(data) {
- alert("ajax返回:" + data);
- });
- });
- });
- });
- </script>
- <title>Example | xHTML1.0</title>
- </head>
- <body>
- <h1>jQuery Ajax Bug Test</h1>
- <ul id="list">
- <li><a href="#" id="1">1</a></li>
- <li><a href="#" id="2">2</a></li>
- <li><a href="#" id="3">3</a></li>
- </ul>
- <div id="confirmForm" style="display:none">
- <p><input type="button" name="confirm_btn" value="回复" /><input type="button" name="cancel_btn" value="取消" /></p>
- </div>
- </body>
- </html>
|
PHP代码:
复制代码
- <?php
- // @Appname myapp
- // @Filename ajaxbug.php
- // @Author casual0402
- // @Contact [email protected]
- $aId = $_GET['aId'];
- echo $aId;
|