I have a problem with the ajax script when I deploy applications on my Linux Server (hosting).

When I deploy on my Linux Server, the script "error: function" does not work and only calls "success: function (response)". As when an error occurs, the method "alert("Data Tidak Ditemukan");" and selector "$ (".validasi").show();" it doesn't work, even though in localhost my application is fine, when I deploy on hosting the problem occurs. Please help me find the problem..

function search() {
  $("#loading").show();
  $.ajax({
    type: "POST",
    url: "<?php echo base_url('pengajuan_ktp/ajax_search'); ?>",
    data: {
      nik: $("#nik").val()
    },
    dataType: "json",
    beforeSend: function(e) {
      if (e && e.overrideMimeType) {
        e.overrideMimeType("application/json;charset=UTF-8");
      }
    },
    success: function(response) {
      if (response.status == "success") {
        $("#nama").val(response.nama);
        $("#alamat").val(response.alamat);
        $("#rt").val(response.rt);
        $("#rw").val(response.rw);
        $("#kelurahan").val(response.kelurahan);
        $("#stat").val(response.stat);
        $("#ktpby").val(response.ktpby);
        $("#ktpdt").val(response.ktpdt);
        $("#suketby").val(response.suketby);
        $("#suketdt").val(response.suketdt);
        $("#loading").hide();
        $(".validasi").hide();
      } else {
        alert("Data Tidak Ditemukan");
      }
    },
    error: function(jqXHR, ajaxOptions, thrownError) { //this doesn't work on my Linux Server
      alert("Data Tidak Ditemukan");
      $(".validasi").show();
      $("#loading").hide();
      document.getElementById('myform').reset();
    }
  });
}

0 Answers