adeeva

crud_checked

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