我正在尝试以编程方式打开一个 jQuery 对话框。我可以打开对话框,但无法将发布数据发送到对话框。
这是代码。
HTML:
<div data-role="page" id="rename-dialog">
<?php
$current_group = $_POST['gr_name'];
$current_code = $_POST['gr_code'];
$current_id = $_POST['in_id'];
?>
<div data-role="header" data-theme="d" class="ui-header ui-bar-d" role="banner">
<a href="#main-page" class="ui-btn-left ui-btn ui-shadow ui-btn-corner-all ui-btn-icon-notext ui-btn-up-d" data-icon="delete" data-iconpos="notext" data-corners="true" data-shadow="true" data-iconshadow="true" data-wrapperels="span" data-theme="d" title="Close" ktbt_p_pass="1">
<span class="ui-btn-inner">
<span class="ui-icon ui-icon-delete ui-icon-shadow"> </span>
</span>
</a>
<h1 class="ui-title" role="heading" aria-level="1">Rename <?php echo $current_group; ?></h1>
</div>
<div data-role='content'>
<form id='rename-group-form' action='' method='post'>
New name for <?php echo $current_group; ?>: <input type='text' name='new-group-name'><br>
<input id='rename-submit' type='submit' data-theme='b' value='Rename'></input>
</form>
</div>
</div>
JAVASCRIPT:
var g_code = parseInt($(this).attr("id"));
var i_id = parseInt($(this).attr("value"));
var g_name = $(this).attr("text");
$.mobile.changePage( "#rename-dialog", {transition: 'slideDown', role: 'dialog'}, {
type: "post",
data: {gr_code: 'test', in_id: 'test', gr_name: 'test'}
});
基本上这会打开对话框,但我收到一个错误,即索引 g_code、in_in 和 gr_name 未定义。
我究竟做错了什么?