2016-08-27 3 views
0

Ich versuche, Bootraps modal POST zu bilden, aber funktioniert nicht. immer wenn ich mit modal versuchte, ist das Ergebnis von Post immer falsch. zum Beispiel ist das Ergebnis meiner Abfrage in Zeile eins abcde, Zeile zwei ist fghij. Ohne Bootstrap modal das Ergebnis richtig ist, aber mit bootsrap modal zeigen immer nur aus Reihe eins ..Wie man Schleifenwert mit mods und mods postsrap mounten?

hier meine Arbeits Code ohne modal, die perfekt

<?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>'; 
      } 
      ?> 

und hier mit bootsrap modal arbeiten, die nicht der Fall ist

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>'; 

Antwort

0

in Bootstrap-Modell arbeiten, um seine nicht funktioniert, verwenden 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

wo sollte ich setze diesen Code ?? Ich habe noch nie jquery verwendet .. –

Verwandte Themen