Advertisement
jamboljack

Cari Data Ajax

Oct 10th, 2017
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function search() {
  2.     $.ajax({
  3.         type: "POST",
  4.         url: "<?php echo site_url('operator/rtlh/checkdata'); ?>",
  5.         data: {
  6.                 nik : $("#nik").val()
  7.         },
  8.         dataType: "json",
  9.         beforeSend: function(e) {
  10.             if(e && e.overrideMimeType) {
  11.                 e.overrideMimeType("application/json;charset=UTF-8");
  12.             }
  13.         },
  14.         success: function(response) {
  15.             $("#loading").hide();
  16.             if(response.status == "success") {
  17.                 // Ambil Nilai
  18.             } else {
  19.                 // Kasih Pesan Error
  20.             }
  21.         },
  22.         error: function (xhr, ajaxOptions, thrownError) {
  23.             alert(xhr.responseText);
  24.         }
  25.     });
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement