[英]Passing parameters in jquery mobile popup
好的,我一直在尝试使用jquery mobile将参数从页面传递到弹出div(在同一页面内)。 我只想能够在弹出窗口中编辑数据库中的内容或项目。 这是我要更新的项目数组:
<div class="ui-block-c">
<?php
$fam_mem = $_db->rows('SELECT * from family_member', array());
foreach($fam_mem as $f)
{
echo "<a href='?id=$f[member_ID]#edit_fam_mem' data-mini='true' data-theme='d' data-inline='true' data-role='button' data-rel='popup' data-position-to='window' data-transition='pop' data-icon='gear' data-iconpos='notext'>Edit</a>";
echo "<a href='?id=$f[member_ID]#delete_fam_mem' data-mini='true' data-theme='d' data-inline='true' data-role='button' data-rel='popup' data-position-to='window' data-transition='pop' data-icon='delete' data-iconpos='notext'>Delete</a>";
}
?>
</div> <!--End ui-block-c-->
这是弹出div的代码:
<div data-role="popup" id="delete_fam_mem" data-theme="d" data-overlay-theme="b" class="ui-content" style="max-width:340px;">
<?php //include_once("./delete_fam_mem.php");?>
<h3>Delete Family Member</h3>
<?php
echo "id is ", $_GET[id]; exit;
$del = $_db->query("DELETE FROM family_member WHERE member_ID = ", array($_GET[id]));
if ( $del )
echo "Chore $_GET[title] deleted successfully.";
else "Could not be deleted, maybe you should go to counseling.";
?>
<button class="button" onclick='closefancy()'>OK!</button>
</div> <!--End Delete Family Member-->
由于某种原因,它不会将ID从页面传递到弹出窗口。 任何帮助将不胜感激! 谢谢!
刚刚提交了一项建议,该建议建议如何将opener
-button中的参数带入弹出式beforeposition
事件中,请参阅https://github.com/jquery/jquery-mobile/issues/7136
放入您的标签ID属性。 就像“ id”一样。 并添加一个元素来获取页面中的值。 喜欢:
<input type="hidden" name="recivedId" />
因此,您可以使用jquery做类似的事情:
$('#a').on('click',function(){
$('#recivedId').val($(this).attr('href'));
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.