我有一個jQuery對話框,當單擊「請確認」按鈕時發佈表單。jQuery-UI對話框丟失<button> POST數組中的名稱/值
我看到我的帖子的數據,但按鈕丟失其名稱/值:
我怎樣才能得到它,以顯示該按鈕的名稱/值?期望的結果
這裏
例子是示例代碼testjQueryDialog.php演示此行爲:
<html><head>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var $dialog = $('<div></div>')
.dialog({
autoOpen: false,
title: 'Are you sure?',
modal: true,
closeOnEscape: true,
buttons: {
"Please confirm": function() {
$(this).dialog("close");
$('#btnSubscription').parents('form').submit();
},
Cancel: function() {
$(this).dialog("close");
}
}
});
$('#btnSubscription').live('click', function() {
$dialog.dialog('open');
return false;
});
});
</script>
</head><body>
<form action="/testjQueryDialog.php" method="post">
<div>
<input name="txtOne" type="text" value="One">
<input name="txtTwo" type="text" value="Two">
<button name="btnSubmit" id="btnSubscription" value="Subscription">Click</button>
</div>
<?php echo 'POST<br>'; print_r($_POST); ?>
</form></body></html>
阿爾喬姆:感謝您的答覆。您提供的鏈接顯示使用傳播的方式,但不回答我的問題。我試過了,它給出了相同的結果:我可以在發佈數據中看到其他表單輸入值/對,但不是
正確傳播的事件應該保留激活的按鈕值。如果您提供您嘗試的代碼,我可以嘗試檢查出現了什麼問題。 –