PHP while循环不能在Bootstrap的modal中工作

Hi in my script I use an Bootstrap modal. The Problem is that I take it in an while - function. The first link for modal works good... open the modal and all.. but not the second, third.... there I can click on the link and nothing happens... anyone an idea?

    <?php while($row = mysql_fetch_array($data)){?>
    <td><a href="#<?php echo $row['id']; ?>" class="glyphicons no-js file_export" id="modal_ajax_demo_btn_<?php echo $row['id']; ?>" data-toggle="modal" title="Testversand"><i></i></a></td>

<div id="ajax-modal-<?php echo $row['id']; ?>" class="modal hide fade" tabindex="-1"></div>

        <script type="text/javascript">
        var UIModals = function () {

        var initModals = function () {

        $.fn.modalmanager.defaults.resize = true;
        $.fn.modalmanager.defaults.spinner = '<div class="loading-spinner fade" style="width: 200px; margin-left: -100px;"><img src="assets/img/ajax-modal-loading.gif" align="middle">&nbsp;<span style="font-weight:300; color: #eee; font-size: 18px; font-family:Open Sans;">&nbsp;Ladevorgang...</div>';


        var $modal = $('#ajax-modal-<?php echo $row['id']; ?>');


        $('#modal_ajax_demo_btn_<?php echo $row['id']; ?>').on('click', function(){
        // create the backdrop and wait for next modal to be triggered
        $('body').modalmanager('loading');
        user_id = $(this).attr('href').replace(/^#/,'');
        setTimeout(function(){

        $modal.load('send1.de', '', function(){
        $modal.modal();
        });
        }, 1000);
        });

        $modal.on('click', '.update', function(){
        $modal.modal('loading');
        setTimeout(function(){

        $.ajax({
        type: "POST",
        url: "send.php",
        data: "id=" + user_id + "&email=" + $("#email").val(),
        success: function(msg)
        {
        $modal
        .modal('loading')
        .find('.modal-body')
        .prepend('<div class="alert alert-success fade in">' +
        'All good!<button type="button" class="close" data-dismiss="alert"></button>' +
        '</div>');
        }
        });return false; 

        }, 5000);
        }); 

        }

        return {
        init: function () {
        initModals();
        }

        };

        }();
        </script>
        </tr>
        <?php } ?> 

Ok I get it. The Problem was the function to initial my javaScript function. Now it works. Of course I must change it also in the function above var UIModals = function () {with the while id.

I used only:

<script>
    jQuery(document).ready(function() {       
            UIModals.init();
    });
</script>

But I need to use:

<script>
    jQuery(document).ready(function() {   
   <?php while($rowinit = mysql_fetch_array($init)){ echo'UIModals'.$rowinit['id'].'.init();';}?>
    });
</script>