gundambison

perbaikan 62(tes)

May 11th, 2018
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script type="text/javascript">
  2.     $(document).ready(function(){
  3.         $('#tes').on('click',function(){
  4.  
  5.           var id="";
  6.           var check=$('[name="check[]"]');
  7. // harusnya check =$(".checklist"); tp sy blum nyoba!!
  8.     for (i = 0; i < check.length; i++){  
  9.   if (check[i].checked){  
  10.    id  = id+ check[i].val() + ","; //value
  11.   }
  12.     }
  13.     if (id==""){ //jika tidak ada buah yg dipilih  
  14.   alert("Silahkan pilih buah favoritmu !");
  15.         check[0].focus();
  16.         return false;
  17.     }
  18.     else{
  19.  
  20.          // alert("Buah favorit kamu : " + id);
  21.     $.ajax({
  22.     type : "POST", //lebih baik post
  23.     url : "<?php echo('crud/tes');?>",
  24.     data :{id:id}, //harusnya akan muncul 2,3,4 gitu
  25.     success: function(html){
  26.     $('#show-data').html(html);
  27.     $('#modal-tes').modal('show');
  28.  
  29.  
  30.     }
  31.  
  32.   });
  33.        
  34.     }
  35.    
  36.        
  37.            
  38.         });
  39.  
  40.     });
  41. </script>
Advertisement
Add Comment
Please, Sign In to add comment