请帮助我,请......我在stackoverflow或其他网站上阅读了很多关于codeigniter的教程,但是我找不到任何可以解决我问题的教程,请教我们。
这是我的Jquery ajax函数的代码,这个文件包含在带有表单的视图中
<script type="text/javascript">
$(document).ready(function() {
$("#Nama").focus();
$("#tglLahirPemohon").datepicker({
changeMonth: true,
changeYear: true,
yearRange: "-100:+20",
});
$( "#anim" ).change(function() {
$( "#tglLahirPemohon" ).datepicker( "option", "showAnim", "slideDown" );
});
$("#tglLahirSuamiIstriPemohon").datepicker({
changeMonth: true,
changeYear: true,
yearRange: "-50:+0",
});
$( "#anim" ).change(function() {
$( "#tglLahirSuamiIstriPemohon" ).datepicker( "option", "showAnim", "slideDown" );
});
$("#tglKeluarPaspor").datepicker({
changeMonth: true,
changeYear: true,
yearRange: "-50:+0",
});
$( "#anim" ).change(function() {
$( "#tglKeluarPaspor" ).datepicker( "option", "showAnim", "slideDown" );
});
$("#masaBerlakuPaspor").datepicker({
changeMonth: true,
changeYear: true,
yearRange: "-50:+0",
});
$( "#anim" ).change(function() {
$( "#masaBerlakuPaspor" ).datepicker( "option", "showAnim", "slideDown" );
});
$("#masaBerlakuVisa").datepicker({
changeMonth: true,
changeYear: true,
yearRange: "-50:+0",
});
$( "#anim" ).change(function() {
$( "#masaBerlakuVisa" ).datepicker( "option", "showAnim", "slideDown" );
});
$("#masaBerlakuKartu").datepicker({
changeMonth: true,
changeYear: true,
yearRange: "-50:+0",
});
$( "#anim" ).change(function() {
$( "#masaBerlakuKartu" ).datepicker( "option", "showAnim", "slideDown" );
});
$("#tanggalLahirAyah").datepicker({
changeMonth: true,
changeYear: true,
yearRange: "-100:+0",
});
$( "#anim" ).change(function() {
$( "#tanggalLahirAyah" ).datepicker( "option", "showAnim", "slideDown" );
});
$("#tanggalLahirIbu").datepicker({
changeMonth: true,
changeYear: true,
yearRange: "-100:+0",
});
$( "#anim" ).change(function() {
$( "#tanggalLahirIbu" ).datepicker( "option", "showAnim", "slideDown" );
});
$("#simpan").click(function(){
var cek = $(".cek:checked");
var string = $("#my-form").serialize();
if(cek.length==0){
$('.bottom-right').notify({
message: {text: 'Maaf, Jenis dokumen tidak boleh kosong'},type:'info'
}).show();
return false();
}
$.ajax({
type : 'POST',
url : "<?php echo site_url(); ?>/peserta/home/simpan_biodata",
data : string,
cache : false,
dataType : 'json',
beforeSend : function(){
//lakukan apasaja sambil menunggu proses selesai disini
//misal tampilkan loading
$(".loading").html("Please wait....");
},
success : function(data){
if(data.status != 'error'){
window.location.assign("<?php echo site_url();?>/peserta/home/foto")
}
alert(data.msg);
}
});
//return false();
});
});
</script>
&#13;
这是我的表格
<div class="ui-widget">
<div class="ui-state-highlight ui-corner-all">
<p align="justify">
<strong><?php echo $judul;?></strong></p>
</div>
</div>
<form id="my-form" name="my-form" method="POST" action="#">
<table class="table table-bordered table-striped table-hover">
<tbody>
<tr>
<td colspan="8"><h5>Kode Dokumen: </h5> <input type="text"
style="
background: #fef556;
font-size: 20px;
height: 20px;
color: #fd1711;
" name="KodeDokumen" value="<?php echo $nomor;?>" readonly=""></input><p align="justify"><font color="red" size="2pt"><b>(Simpan kode ini dan gunakan untuk melihat status dokumen anda)</b></font></p></td>
</tr>
<tr>
<td colspan="2"><h4>A. Jenis Dokumen</h4></td>
</tr>
<tr>
<td class="span4">Jenis Dokumen<span style="color: red"><b>*</b></span></br>
<font style="calibri" color="red">(Wajib diisi)</font></td>
<td><input type="radio" class="cek" name="jenisDokumen" Value="Lapor Diri"> Lapor Diri </input></br>
<input type="radio" class="cek" name="jenisDokumen" Value="Pembuatan Paspor Baru"> Pembuatan Paspor Baru </input></br>
<input type="radio" class="cek" name="jenisDokumen" Value="Perpanjangan Paspor"> Perpanjangan Paspor </input></br>
<input type="radio" class="cek" name="jenisDokumen" Value="Perubahan Data Paspor"> Perubahan Data Paspor </input></br>
<input type="radio" class="cek" name="jenisDokumen" Value="Surat Keterangan / dll"> Surat Keterangan / dll </input></td>
</tr>
<tr>
<td colspan="2"><h4>B. Informasi Data Diri Pemohon</h4></td>
</tr>
<tr>
<td class="span4">1. Nama Lengkap</td>
<td><input type="text" name="namaLengkap" id="namaLengkap" class="span4"></td>
</tr>
<tr>
<td>2. Tempat/Tanggal Lahir</td>
<td><input type="text" name="tempatLahirPemohon" id="tempatLahirPemohon" class="span3"> <input type="text" name="tglLahirPemohon" id="tglLahirPemohon" class="span2"> *) Format : tgl-bln-thn</td>
</tr>
<tr>
<td>3. Jenis Kelamin</td>
<td><input type="radio" name="jenisKelaminPemohon" Value="Pria"> Pria <input type="radio" name="jenisKelaminPemohon" value="Wanita"> Wanita</input></td>
</tr>
<tr>
<td>4. Status</td>
<td><input type="radio" name="statusPemohon" Value="Nikah"> Nikah <input type="radio" name="statusPemohon" value="Belum Nikah"> Belum Nikah <input type="radio" name="statusPemohon" value="J"> Janda <input type="radio" name="statusPemohon" value="D"> Duda </td>
</tr>
<tr>
<td>5. Agama</td>
<td>
<select name="agamaPemohon" id="agamaPemohon" class="span2">
<option value="">-PILIH-</option>
<option value="Islam">Islam</option>
<option value="Kristen">Kristen</option>
<option value="Katolik">Katolik</option>
<option value="Hindu">Hindu</option>
<option value="Buddha">Buddha</option>
<option value="Lain-lain">Lain-lain</option>
</select>
</td>
</tr>
<tr>
<td class="span4">6. Nama Suami/Istri</td>
<td><input type="text" name="namaSuamiIstriPemohon" id="namaSuamiIstriPemohon" class="span4"></td>
</tr>
<tr>
<td>7. Tempat/Tanggal Lahir Istri/Suami</td>
<td><input type="text" name="tempatLhrSuamiIstriPemohon" id="tempatLhrSuamiIstriPemohon" class="span3"> <input type="text" name="tglLahirSuamiIstriPemohon" id="tglLahirSuamiIstriPemohon" class="span2"> *) Format : tgl-bln-thn</td>
</tr>
<tr>
<td>8. Kewarganegaraan Istri/Suami</td>
<td>
<select name="kewarganegaraanSuamiIstriPemohon" id="kewarganegaraanSuamiIstriPemohon" class="span2">
<option value="WNI">WNI</option>
<option value="WNA">WNA</option>
</select>
</td>
</tr>
<tr>
<td class="span4">9. Jenis Paspor</td>
<td><input type="radio" name="jenisPaspor" Value="Biasa"> Biasa <input type="radio" name="jenisPaspor" value="Dinas"> Dinas <input type="radio" name="jenisPaspor" value="Diplomatik"> Diplomatik Nomor: <input type="text" name="nomorPaspor" id="nomorPaspor" class="span3"></td>
</tr>
<tr>
<td>10. Tempat/Tanggal Pengeluaran</td>
<td><input type="text" name="tempatKeluarPaspor" id="tempatKeluarPaspor" class="span3"> <input type="text" name="tglKeluarPaspor" id="tglKeluarPaspor" class="span2"> *) Format : tgl-bln-thn</td>
</tr>
<tr>
<td>11. Masa Berlaku Hingga</td>
<td><input type="text" name="masaBerlakuPaspor" id="masaBerlakuPaspor" class="span2"> *) Format : tgl-bln-thn</td>
</tr>
<tr>
<td class="span4">12. Jenis Visa Amerika</td>
<td><input type="radio" name="jenisVisaAmerika" Value="Permanent Resident"> Permanent Resident <input type="radio" name="jenisVisaAmerika" value="Lain-lain"> Lain-lain <input type="text" name="visaAmerikaLain" id="visaAmerikaLain" class="span2"> Nomor: <input type="text" name="nomorVisaAmerika" id="nomorVisaAmerika" class="span2"></td>
</tr>
<tr>
<td>13. Masa Berlaku Hingga</td>
<td><input type="text" name="masaBerlakuVisa" id="masaBerlakuVisa" class="span2"> *) Format : tgl-bln-thn</td>
</tr>
<tr>
<td class="span4">14. Kartu Ijin Tinggal di Amerika</td>
<td><input type="radio" name="jenisKartuIjinTinggal" Value="I-94"> I-94 <input type="radio" name="jenisKartuIjinTinggal" Value="I-20"> I-20 <input type="radio" name="jenisKartuIjinTinggal" value="Lain-lain"> Lain-lain <input type="text" name="kartuIzinLain" id="kartuIzinLain" class="span2"> Nomor: <input type="text" name="nomorKartuIjinTinggal" id="nomorKartuIjinTinggal" class="span2"></td>
</tr>
<tr>
<td>15. Masa Berlaku Hingga</td>
<td><input type="text" name="masaBerlakuKartu" id="masaBerlakuKartu" class="span2"> *) Format : tgl-bln-thn</td>
</tr>
<tr>
<td class="span4">16. Pekerjaan</br>
<p align="justify"><font size="2pt" color="red">(Agar ditandai seakurat mungkin, apabila tidak ada kategorinya, dapat disebutkan Lain-lain)</font></p></td>
<td>
<table class="table-bordered">
<tr>
<td class="span3">
<input type="checkbox" name="pekerjaanPemohon" Value="Dokter"> Dokter</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Dosen"> Dosen</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Pengacara"> Pengacara</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Pilot"> Pilot</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Pramugari/a"> Pramugari/a</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Pengusaha"> Pengusaha</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Perminyakan"> Perminyakan</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Pertambangan"> Pertambangan</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Konstruksi"> Konstruksi</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Industri(Laki-laki)"> Industri(Laki-laki)</input></br>
</td>
<td class="span3">
<input type="checkbox" name="pekerjaanPemohon" Value="Industri(Wanita)"> Industri(Wanita)</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Perkebunan"> Perkebunan</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Chauffeur"> Chauffeur</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Chauffeur/Delivery"> Chauffeur/Delivery</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="PLRT/Helper"> PLRT/Helper</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Babysitter"> Babysitter</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Caregiver/Nurse"> Caregiver/Nurse</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Petugas Kebersihan"> Petugas Kebersihan</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Pertokoan"> Pertokoan</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Perhotelan/Wisata"> Perhotelan/Wisata</input></br>
</td>
<td class="span3">
<input type="checkbox" name="pekerjaanPemohon" Value="Restaurant"> Restaurant</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="SPBU/Gas Station"> SPBU/Gas Station</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Mahasiswa/Pelajar"> Mahasiswa/Pelajar</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Ibu Rumah Tangga"> Ibu Rumah Tangga</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Kapal Pesiar"> Kapal Pesiar</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Kapal Cargo"> Kapal Cargo</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Kapal Ikan"> Kapal Ikan</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Kapal Tanker"> Kapal Tanker</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Rohaniawan/wati"> Rohaniawan/wati</input></br>
<input type="checkbox" name="pekerjaanPemohon" Value="Lain-lain"> Lain-lain</input></br>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>17. Nama Perusahaan/Sekolah</td>
<td>
<input type="text" name="namaPerusahaanSekolahPem" id="namaPerusahaanSekolahPem" class="span6">
</td>
</tr>
<tr>
<td>18. Alamat Perusahaan/Sekolah</td>
<td><input type="text" name="alamatPerusahaanSekolahPem1" id="alamatPerusahaanSekolahPem1" class="span8">
<input type="text" name="alamatPerusahaanSekolahPem2" id="alamatPerusahaanSekolahPem2" class="span8">
</td>
</tr>
<tr>
<td>19. Alamat Rumah</td>
<td><input type="text" name="alamatRumahPem1" id="alamatRumahPem1" class="span8">
<input type="text" name="alamatRumahPem2" id="alamatRumahPem2" class="span8">
</td>
</tr>
<tr>
<td>20. Nomor Telepon</td>
<td>
<table class="table-bordered">
<tr>
<td class="span3">Rumah </td>
<td><input type="text" name="telpRumahPem" id="telpRumahPem" class="span3"></td>
</tr>
<tr>
<td class="span3">Kantor/Tempat Bekerja </td>
<td><input type="text" name="telpKantorPem" id="telpKantorPem" class="span3"></td>
</tr>
<tr>
<td class="span3">Cellular </td>
<td><input type="text" name="hpPemohon" id="hpPemohon" class="span3"></td
</tr>
</table>
</td>
</tr>
<tr>
<td>21. Email</td>
<td>
<input type="text" name="emailPemohon" id="emailPemohon" class="span6">
</td>
</tr>
<tr>
<td colspan="3"><h4>C. Informasi Keluarga di <b><u>Amerika</u></b>/Kontak Dalam Keadaan Darurat (Family/Emergency Contact)</h4></td>
</tr>
<tr>
<td>22. Nama</td>
<td><input type="text" name="namaKeluargaAmerika" id="namaKeluargaAmerika" class="span3"></td>
</tr>
<tr>
<td>23. Alamat di Amerika</td>
<td><input type="text" name="alamatAmerika1" id="alamatAmerika1" class="span8">
<input type="text" name="alamatAmerika2" id="alamatAmerika2" class="span8">
</td>
</tr>
<tr>
<td>24. Nomor Telepon</td>
<td>
<table class="table-bordered">
<tr>
<td class="span3">Rumah </td>
<td><input type="text" name="noTelRumahAmerika" id="noTelRumahAmerika" class="span3"></td>
</tr>
<tr>
<td class="span3">Kantor/Tempat Bekerja </td>
<td><input type="text" name="noTelKantorAmerika" id="noTelKantorAmerika" class="span3"></td>
</tr>
<tr>
<td class="span3">Cellular </td>
<td><input type="text" name="noCelAmerika" id="noCelAmerika" class="span3"></td
</tr>
</table>
</td>
</tr>
<tr>
<td>25. Email</td>
<td>
<input type="text" name="emailAmerika" id="emailAmerika" class="span6">
</td>
</tr>
<tr>
<td colspan="3"><h4>D. Informasi Keluarga di <b><u>Indonesia</u></b>/Kontak Dalam Keadaan Darurat (Family/Emergency Contact)</h4></td>
</tr>
<tr>
<td>26. Nama</td>
<td><input type="text" name="namaKeluargaIndonesia" id="namaKeluargaIndonesia" class="span3"></td>
</tr>
<tr>
<td>27. Alamat di Amerika</td>
<td><input type="text" name="alamatKeluargaIndonesia1" id="alamatKeluargaIndonesia1" class="span8">
<input type="text" name="alamatKeluargaIndonesia2" id="alamatKeluargaIndonesia2" class="span8">
</td>
</tr>
<tr>
<td>28. Nomor Telepon</td>
<td>
<table class="table-bordered">
<tr>
<td class="span3">Rumah </td>
<td><input type="text" name="noTelRumahIndonesia" id="noTelRumahIndonesia" class="span3"></td>
</tr>
<tr>
<td class="span3">Kantor/Tempat Bekerja </td>
<td><input type="text" name="noTelKantorIndonesia" id="noTelKantorIndonesia" class="span3"></td>
</tr>
<tr>
<td class="span3">Cellular </td>
<td><input type="text" name="noCelIndonesia" id="noCelIndonesia" class="span3"></td
</tr>
</table>
</td>
</tr>
<tr>
<td>29. Email</td>
<td>
<input type="text" name="emailIndonesia" id="emailIndonesia" class="span6">
</td>
</tr>
<tr>
<td colspan="3"><h4>E. Khusus Untuk Pengesahan Perubahan (Endorsement) di Dalam Paspor</h4></td>
</tr>
<tr>
<td>30. Data Yang Berubah</td>
<td>
<input type="radio" name="dataBerubah" Value="Nama"> Nama</input>
<input type="radio" name="dataBerubah" Value="Alamat"> Alamat</input>
<input type="radio" name="dataBerubah" Value="Pekerjaan"> Pekerjaan</input>
<input type="radio" name="dataBerubah" Value="Status Sipil"> Status Sipil</input>
<input type="radio" name="dataBerubah" Value="Lain-lain"> Lain-lain</input></td>
</tr>
<tr>
<td>31. Data Semula</td>
<td><input type="text" name="berubahDari" id="berubahDari" class="span8"></td>
</tr>
<tr>
<td>32. Data Dirubah Menjadi </td>
<td><input type="text" name="berubahKe" id="berubahKe" class="span8"></td>
</tr>
<tr>
<td colspan="3"><h4>F. Khusus Untuk Pendataan Anak di Bawah Usia 18 Tahun</h4></td>
</tr>
<tr>
<td>33. Nama Ayah/No. Paspor </td>
<td><input type="text" name="namaAyahNopaspor" id="namaAyahNopaspor" class="span8"></td>
</tr>
<tr>
<td>34. Tempat/Tanggal Lahir </td>
<td><input type="text" name="tempatLahirAyah" id="tempatLahirAyah" class="span3"> <input type="text" name="tanggalLahirAyah" id="tanggalLahirAyah" class="span2"> *) Format : tgl-bln-thn</td>
</tr>
<tr>
<td>35. Nama Ibu/No. Paspor </td>
<td><input type="text" name="namaIbuNoPaspor" id="namaIbuNoPaspor" class="span8"></td>
</tr>
<tr>
<td>36. Tempat/Tanggal Lahir </td>
<td><input type="text" name="tempatLahirIbu" id="tempatLahirIbu" class="span3"> <input type="text" name="tanggalLahirIbu" id="tanggalLahirIbu" class="span2"> *) Format : tgl-bln-thn</td>
</tr>
<tr>
<td colspan="2">Silahkan Klik Lanjut !!!</td>
</tr>
<tr>
<td colspan="2"><center>
<a href="<?php echo base_url();?>" class="btn btn-info"><i class="icon-off icon-white"></i> Batal</a>
<button type="button" name="simpan" id="simpan" class="btn btn-primary" onclick="return();"><i class="icon-hand-right icon-white"></i> Lanjut Ke Step 2</button>
</center>
</tbody>
</table>
</form>
&#13;
最后这是我的php函数,用于保存CI控制器中的数据
public function simpan_biodata()
{
date_default_timezone_set('Asia/Jakarta');
$status = "";
$msg = "";
// convert tanggal
$tglLahirPemohon = $this->app_model->tgl_sql($this->input->post('tglLahirPemohon'));
$tglLahirSuamiIstriPemohon = $this->app_model->tgl_sql($this->input('tglLahirSuamiIstriPemohon'));
$tglKeluarPaspor = $this->app_model->tgl_sql($this->input('tglKeluarPaspor'));
$masaBerlakuPaspor = $this->app_model->tgl_sql($this->input('masaBerlakuPaspor'));
$masaBerlakuVisa = $this->app_model->tgl_sql($this->input('masaBerlakuVisa'));
$masaBerlakuKartu = $this->app_model->tgl_sql($this->input('masaBerlakuKartu'));
$tanggalLahirAyah = $this->app_model->tgl_sql($this->input('tanggalLahirAyah'));
$tanggalLahirIbu = $this->app_model->tgl_sql($this->input('tanggalLahirIbu'));
$d['KodeDokumen'] = $this->input->post('KodeDokumen');
$d['tglEntryDokumen'] = date('Y-m-d');//$this->input->post('');
$d['jenisDokumen'] = $this->input->post('jenisDokumen');
$d['namaLengkap'] = $this->input->post('namaLengkap');
$d['tempatLahirPemohon'] = $this->input->post('tempatLahirPemohon');
$d['tglLahirPemohon'] = $tglLahirPemohon;
$d['jenisKelaminPemohon'] = $this->input->post('jenisKelaminPemohon');
$d['statusPemohon'] = $this->input->post('statusPemohon ');
$d['agamaPemohon'] = $this->input->post('agamaPemohon');
$d['namaSuamiIstriPemohon'] = $this->input->post('namaSuamiIstriPemohon');
$d['tempatLhrSuamiIstriPemohon'] = $this->input->post('tempatLhrSuamiIstriPemohon');
$d['tglLahirSuamiIstriPemohon'] = $tglLahirSuamiIstriPemohon;
$d['kewarganegaraanSuamiIstriPemohon'] = $this->input->post('kewarganegaraanSuamiIstriPemohon');
$d['jenisPaspor'] = $this->input->post('jenisPaspor');
$d['nomorPaspor'] = $this->input->post('nomorPaspor');
$d['tempatKeluarPaspor'] = $this->input->post('tempatKeluarPaspor');
$d['tglKeluarPaspor'] = $tglKeluarPaspor;
$d['masaBerlakuPaspor'] = $masaBerlakuPaspor;
$d['jenisVisaAmerika'] = $this->input->post('jenisVisaAmerika');
$d['visaAmerikaLain'] = $this->input->post('visaAmerikaLain');
$d['nomorVisaAmerika'] = $this->input->post('nomorVisaAmerika');
$d['masaBerlakuVisa'] = $this->input->post('masaBerlakuVisa');
$d['jenisKartuIjinTinggal'] = $this->input->post('jenisKartuIjinTinggal');
$d['kartuIzinLain'] = $this->input->post('kartuIzinLain');
$d['nomorKartuIjinTinggal'] = $this->input->post('nomorKartuIjinTinggal');
$d['masaBerlakuKartu'] = $this->input->post('masaBerlakuKartu');
$d['pekerjaanPemohon'] = $this->input->post('pekerjaanPemohon');
$d['namaPerusahaanSekolahPem'] = $this->input->post('namaPerusahaanSekolahPem');
$d['alamatPerusahaanSekolahPem1'] = $this->input->post('alamatPerusahaanSekolahPem1');
$d['alamatPerusahaanSekolahPem2'] = $this->input->post('alamatPerusahaanSekolahPem2');
$d['alamatRumahPem1'] = $this->input->post('alamatRumahPem1');
$d['alamatRumahPem2'] = $this->input->post('alamatRumahPem2');
$d['telpRumahPem'] = $this->input->post('telpRumahPem');
$d['telpKantorPem'] = $this->input->post('telpKantorPem');
$d['hpPemohon'] = $this->input->post('hpPemohon');
$d['emailPemohon'] = $this->input->post('emailPemohon');
$d['namaKeluargaAmerika'] = $this->input->post('namaKeluargaAmerika');
$d['alamatAmerika1'] = $this->input->post('alamatAmerika1');
$d['alamatAmerika2'] = $this->input->post('alamatAmerika2');
$d['noTelRumahAmerika'] = $this->input->post('noTelRumahAmerika');
$d['noTelKantorAmerika'] = $this->input->post('noTelKantorAmerika');
$d['noCelAmerika'] = $this->input->post('noCelAmerika');
$d['emailAmerika'] = $this->input->post('emailAmerika');
$d['namaKeluargaIndonesia'] = $this->input->post('namaKeluargaIndonesia');
$d['alamatKeluargaIndonesia1'] = $this->input->post('alamatKeluargaIndonesia1');
$d['alamatKeluargaIndonesia2'] = $this->input->post('alamatKeluargaIndonesia2');
$d['noTelRumahIndonesia'] = $this->input->post('noTelRumahIndonesia');
$d['noTelKantorIndonesia'] = $this->input->post('noTelKantorIndonesia');
$d['noCelIndonesia'] = $this->input->post('noCelIndonesia');
$d['emailIndonesia'] = $this->input->post('emailIndonesia');
$d['dataBerubah'] = $this->input->post('dataBerubah');
$d['berubahDari'] = $this->input->post('berubahDari');
$d['berubahKe'] = $this->input->post('berubahKe');
$d['namaAyahNopaspor'] = $this->input->post('namaAyahNopaspor');
$d['tempatLahirAyah'] = $this->input->post('tempatLahirAyah');
$d['tanggalLahirAyah'] = $this->input->post('tanggalLahirAyah');
$d['namaIbuNoPaspor'] = $this->input->post('namaIbuNoPaspor');
$d['tempatLahirIbu'] = $this->input->post('tempatLahirIbu');
$d['tanggalLahirIbu'] = $this->input->post('tanggalLahirIbu');
$this->app_model->insertData("tbpemohon",$d);
$status="sukses";
$msg="Data Sukses disimpan";
echo json_encode(array('status' => $status, 'msg' => $msg));
}
这是我的模特
class App_Model扩展了CI_Model {
public function getAllData($table)
{
return $this->db->get($table);
}
public function getAllDataLimited($table,$limit,$offset)
{
return $this->db->get($table, $limit, $offset);
}
public function getSelectedDataLimited($table,$data,$limit,$offset)
{
return $this->db->get_where($table, $data, $limit, $offset);
}
//select table
public function getSelectedData($table,$data)
{
return $this->db->get_where($table, $data);
}
//update table
function updateData($table,$data,$field_key)
{
$this->db->update($table,$data,$field_key);
}
function deleteData($table,$data)
{
$this->db->delete($table,$data);
}
function insertData($table,$data)
{
$this->db->insert($table,$data);
}
}
感谢您的帮助。
最好的问候
Nanang
答案 0 :(得分:0)
请尝试使用此解决方案。
var fd = new FormData(document.getElementById("my-form"));
$.ajax({
type:"POST",
url:"<?php echo site_url('peserta/home/simpan_biodata'); ?>",
data:fd,
enctype: 'multipart/form-data',
processData: false, // tell jQuery not to process the data
contentType: false , // tell jQuery not to set contentType
success:function(data){
//var str = JSON.parse(data);
console.log(data);
},
error:function(err){
console.log(data);
}
});
答案 1 :(得分:0)
// convert tanggal
$tglLahirPemohon = $this->app_model->tgl_sql($this->input->post('tglLahirPemohon'));
$tglLahirSuamiIstriPemohon = $this->app_model->tgl_sql($this->input('tglLahirSuamiIstriPemohon'));
$tglKeluarPaspor = $this->app_model->tgl_sql($this->input('tglKeluarPaspor'));
$masaBerlakuPaspor = $this->app_model->tgl_sql($this->input('masaBerlakuPaspor'));
$masaBerlakuVisa = $this->app_model->tgl_sql($this->input('masaBerlakuVisa'));
$masaBerlakuKartu = $this->app_model->tgl_sql($this->input('masaBerlakuKartu'));
$tanggalLahirAyah = $this->app_model->tgl_sql($this->input('tanggalLahirAyah'));
$tanggalLahirIbu = $this->app_model->tgl_sql($this->input('tanggalLahirIbu'));
,正确的代码是
$tglLahirPemohon = $this->app_model->tgl_sql($this->input->post('tglLahirPemohon'));
$tglLahirSuamiIstriPemohon = $this->app_model->tgl_sql($this->input->post('tglLahirSuamiIstriPemohon'));
$tglKeluarPaspor = $this->app_model->tgl_sql($this->input->post('tglKeluarPaspor'));
$masaBerlakuPaspor = $this->app_model->tgl_sql($this->input->post('masaBerlakuPaspor'));
$masaBerlakuVisa = $this->app_model->tgl_sql($this->input->post('masaBerlakuVisa'));
$masaBerlakuKartu = $this->app_model->tgl_sql($this->input->post('masaBerlakuKartu'));
$tanggalLahirAyah = $this->app_model->tgl_sql($this->input->post('tanggalLahirAyah'));
$tanggalLahirIbu = $this->app_model->tgl_sql($this->input->post('tanggalLahirIbu'));
非常感谢你