SHARE
TWEET

Untitled

a guest Dec 13th, 2016 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. while($row = mysqli_fetch_array($query))
  2. {
  3.     echo "<tr class = 'raw' id = 'data'>";
  4.     echo "  <td><button onclick = 'gettahun(".$row['kdTahun'].")' data-dismiss='modal'>#</button></td>";
  5.     echo "  <td class = 'kdTAHUN'>".$row['kdTahun']."</td>";
  6.     echo "  <td class = 'TAHUN'>".$row['tahun']."</td>";
  7.     echo "</tr>";
  8. }
  9.    
  10. function getfakultas(pilih)
  11. {
  12.     $.ajax({
  13.         type: "GET",
  14.         url: "routes/getfakulas.php",
  15.         data: {"kdFakultas":pilih},
  16.         success: function(hasil)
  17.         {
  18.             var result = $.parseJSON(hasil);
  19.             $("#kdFakultas").val(result.KDFAKULTAS);
  20.             $("#Fakultas").val(result.FAKULTAS);
  21.             $('#kdFakultas').attr('readonly', true);
  22.         },
  23.         error:function (xhr, ajaxOptions, thrownError){
  24.            if(xhr.status==404) {
  25.                alert(thrownError);
  26.           }
  27.        }
  28.     });
  29. }
  30.    
  31. <?php
  32. session_start();
  33. $host = "localhost";
  34. $user = "root";
  35. $pass = "";
  36. $name = "buku_tahunan";
  37.  
  38. $koneksi = mysqli_connect($host,$user,$pass,$name);
  39.  
  40. if(mysqli_connect_errno())
  41. {
  42.     die("koneksi DB Gagal".mysqli_connect_error());
  43. }
  44. $kdfakultas = $_GET["kdFakultas"];
  45.  
  46. $sql="SELECT * FROM `fakultas` WHERE kdFakultas = '$kdfakultas'";
  47.  
  48. $query = mysqli_query($koneksi,$sql);
  49.  
  50. while($row = mysqli_fetch_array($query))
  51. {
  52.     $output =  array('KDFAKULTAS'=>$row['kdFakultas'],
  53.              'FAKULTAS'=>$row['nmFakultas']);
  54.     echo json_encode($output);
  55. }
  56.  ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top