2016-08-27 9 views
0

bootraps modalをPOSTに挿入しようとしていますが、動作しません。 私がモーダルで試したときはいつも、投稿の結果は常に間違っています。 たとえば、1行目の私のクエリの結果はabcde、2行目はfghijです。ブートストラップなしで私の作業コードは完全ではないんbootsrapモーダルとbootsrapモーダルとフォーム投稿でループ値を投稿する方法は?

<?php $no=1; foreach ($result2 as $row) { 
     if ($row->status_vld == 0){ 
     $valid = 'Belum Valid'; } 
     else { 
     $valid = 'sudah valid';} 

      echo '<tr>'; 
      echo '<td>'.$no++.'</td>'; 

      echo '<td>'.$row->nama_tabel.' '; 
      echo 
'<form action="validasi_mahasiswa" method="POST" role="form" class="form-horizontal"> 
<div class="form-group"> 
    <input type="hidden" class="form-control" id="valid" name="validasi" value='.$row->nama_tabel.'> 
    </div> 
    <button type="submit" class="btn btn-primary">VALIDASI</button> 
</form> 
      </td>'; 
      echo '<td>'.$row->pt_upload.'</td>'; 
      echo '<td>'.$row->id_pt.'</td>'; 
       echo '<td>'.$row->tgl_upload.'</td>'; 
       echo '<td>'.$valid.'</td>'; 
       echo '</tr>'; 
      } 
      ?> 

、ここで働いているモーダルせずにここに...常にのみ行1から表示されるに結果は右ですが、bootsrapモーダルで

モーダルその動作しないブートストラップモデルに

echo ' 

<form action="validasi_mahasiswa" method="POST" role="form" class="form-horizontal"> 

    <input type="hidden" class="form-control" id="valid" name="validasi" value='.$row->nama_tabel.'> 

    <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button> 

    <div class="modal fade" id="myModal" role="dialog"> 

    <div class="modal-dialog"> 

     <div class="modal-content"> 

     <div class="modal-body"> 


     <div class="form-group"> 
    <button type="submit" class="btn btn-primary">VALIDASI</button> 
    </div> 
    </div> 
    </div> 
    </div> 
    </div> 

    </form> 
      </td>'; 

答えて

0

仕事、使用jqueryの

$('.load-modal').on('click', function(e){ 
    e.preventDefault(); 
    var url = $(this).attr('attr'); 

    $.ajax({ 
     url: url, 
     type: 'post', 
     async: false, 
     success: function(response){ 
      $('#ajax-response').html(response); 
      $('#myModal').modal('show'); 
     } 
    }) 
}) 
+0

私がすべきこのコードを置く??私は以前はjqueryを使っていません。 –

関連する問題