如何在echo php

时间:2018-03-02 07:36:10

标签: php jquery ajax

需要帮助如何使我的模态显示我很难从fetch.php制作我的模态,这是一个echo模式,显示在我的index.php上它根本不显示只显示id在网页上。

 $query = "
      SELECT * FROM users ORDER BY id
     ";
    }
    $result = mysqli_query($connect, $query);
    if(mysqli_num_rows($result) > 0)
    {
     $output .= '
      <div class="table-responsive">
       <table class="table table bordered">
        <tr>
         <th>Name</th>
         <th>Email</th>
         <th>Username</th>
         <th>Level Code</th>
         <th>Action</th>
        </tr>
     ';
     while($row = mysqli_fetch_array($result))
     {
      $output .= '
       <tr>
        <td>'.$row["name"].'</td>
        <td>'.$row["email"].'</td>
        <td>'.$row["username"].'</td>
        <td>'.$row["level"].'</td>
        <td><a style="cursor:pointer;" class="btn btn-warning edit" data-id="<?php echo $row[id"];"><span class="glyphicon glyphicon-edit"></span> Edit</a> 

        </td><tr/>

       </tr>
      ';
     }
     echo $output;
    }
    else
    {
     echo 'Data Not Found';
    }

    ?>

我的模态在这里,jquery在这里

$(document).on('click', '.edit', function(){
        var memid = $(this).data('id');
        var department_name = $('#department_name'+memid).text();
        var last = $('#last'+memid).text();
        $('#editmem').modal('show');
        $('#efirstname').val(department_name);
        $('#elastname').val(last);
        $('#editbutton').val(memid);
    });

    $('#editbutton').click(function(){
        var memid = $(this).val();
        var editForm = $('#editForm').serialize();
        $.ajax({
            type: 'POST',
            url: 'edit.php',
            data: editForm + "&memid="+memid,
            success:function(){
                $('#editmem').modal('hide');
                $('#editForm')[0].reset();
                showTable();
                $('#alert').slideDown();
                $('#alerttext').text('Member Updated Successfully');
            }
        });
    });

这个我的模态就在这里我试图想办法让我的模态出现在我的索引上

<div class="modal fade" id="editmem" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <center><h4 class="modal-title" id="myModalLabel">Edit Member</h4></center>
                </div>
                <div class="modal-body">
                <div class="container-fluid">
                <form id="editForm">
                    <div class="row">
                        <div class="col-md-2">
                            <label class="control-label" style="position:relative; top:7px;">Firstname:</label>
                        </div>

0 个答案:

没有答案