繁体   English   中英

PHP-jQuery-简单的模式公开数据?

[英]PHP - Jquery - simple modal open data?

我只是莫代尔:

<div id="info" style="display: none;">

    <h3 class="title">User info</h3>

    <table border="0" cellpadding="5" cellspacing="0">
        <tr>
            <td width="50%" align="right">ID user:</td>
            <td>1</td>
        </tr>
        <tr>
            <td width="50%" align="right">Login:</td>
            <td>1</td>
        </tr>
    </table>

</div>

和php脚本:

$get = mysql_query("SELECT * FROM users");
while($user = mysql_fetch_assoc($get)) {
echo '<a href="#" title="" class="open_info">Wyświetl info o '.$user['login'].'</a>';
}

JS - 打开信息点击:

$('.open_info').click(function(e){
        $('#info').modal({
            autoResize: true
        });
        return false;
    });

我不知道如何从用户这个用户数据显示信息。

救命 :(

你正在模态中打开一个隐藏的div,你应该使用隐藏的包装div并在模态中打开内部div。

<div style="display: none;">
    <div id="info">

    <h3 class="title">User info</h3>

    <table border="0" cellpadding="5" cellspacing="0">
        <tr>
            <td width="50%" align="right">ID user:</td>
            <td>1</td>
        </tr>
        <tr>
            <td width="50%" align="right">Login:</td>
            <td>1</td>
        </tr>
    </table>

</div>
</div>

尝试使用此方法。

尝试这个..

 $get = mysql_query("SELECT * FROM users");
    while($user = mysql_fetch_assoc($get)) {
    echo '<a href="#" title="" class="open_info" id="'.$user['id'].'">Wyświetl info o '.$user['login'].'</a>';
echo '<div id="'.$user['id'].'" style="display: none;" >

    <h3 class="title">User info</h3>

    <table border="0" cellpadding="5" cellspacing="0">
        <tr>
            <td width="50%" align="right">ID user:</td>
            <td>1</td>
        </tr>
        <tr>
            <td width="50%" align="right">Login:</td>
            <td>1</td>
        </tr>
    </table>

</div>';
    }

    $(".open_info").click(function(){
    var getid = $(this).attr("id");
    var docnumbers = new Array();
    $('.open_info').each(function() {
       var selectdoc=this.id;
    if(getid==selectdoc)
    {
    $("#"+selectdoc).show();
    } else {
    $("#"+selectdoc).hide();
    }

    });
    });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM