I have a jQuery dialog that posts a form when the "Please Confirm" button is clicked.
I see my post data, but the button is missing its name/value:
How can I get it to display the button name/value?
example of desired result
Here is example code testjQueryDialog.php that demonstrates this behavior:
<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>