0

好的,我一直在努力尝试使用 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 传递给弹出窗口。任何帮助将不胜感激!谢谢!

4

2 回答 2

0

刚刚提交了一份提案,建议如何将opener-button 中的参数带入弹出beforeposition事件,请参阅https://github.com/jquery/jquery-mobile/issues/7136

于 2014-02-20T08:14:47.463 回答
-1

放入您的标签 id 属性。就像“身份证”一样。并放置一个元素来接收页面中的值。喜欢:

    <input type="hidden" name="recivedId" />

所以你可以使用 jquery 做类似的事情:

$('#a').on('click',function(){
   $('#recivedId').val($(this).attr('href'));
})
于 2013-01-23T20:02:34.410 回答