[ad_1]
I'm not familiar using javascript & jquery in modal bootstrap, and need your advice.
I create a modal to insert data into database. but when i click 'save' button nothing happen.
I hope you can help me to check if there's something wrong with my codes. I spent a weeks searching if there any error in my codes.
Here is my view :
$(document).on("click", ".open-InputNilaiDialog", function ()
var myFormId = $(this).data('id');
$(".modal-body #nim").val( myFormId );
);
<div class="modal fade" id="inputNilaiDialog" role="dialog" >
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span></button>
<h4 class="modal-title">Form Nilai</h4>
</div>
<div class="modal-body">
<p>Contoh</p>
<form class="form-horizontal" method="post" action="<?php echo base_url().'tutor/mtk_np/simpan'?>">
<div class="box-body">
<div class="form-group">
<div class="col-sm-10">
<input type="hidden" class="form-control" id="idtutor" name="idtutor" value="<?php echo $this->session->userdata('username'); ?>"/>
</div>
</div>
<div class="form-group">
<label for="nim" class="col-sm-2 control-label">NIM</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="nim" name="nim" readonly />
</div>
</div>
<div class="form-group">
<label for="nilai" class="col-sm-2 control-label">Nilai</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="nilai" name="nilai" readonly />
</div>
</div>
<!-- START INPUT HIDDEN-->
<input type="hidden" class="form-control" id="kd_mtk" name="kd_mtk" value="<?php echo $row->kode_mtk; ?>"/>
<input type="hidden" class="form-control" id="kelas" name="kelas" value="<?php echo $row->kelas; ?>"/>
<!-- END INPUT HIDDEN-->
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">Tutup</button>
<button type="button" class="btn btn-primary">Simpan</button>
</div>
</form>
</div>
</div>
</div>
</div>
This is my controller :
public function simpan()
$data = array (
'idtutor' => $this->input->post('idtutor'),
'nim' => $this->input->post('nim'),
'kd_mtk' => $this->input->post('kd_mtk'),
'kelas' => $this->input->post('kelas'),
'nilai' => $this->input->post('nilai')
);
$this->mtk_model->simpan($data);
redirect(base_url(). "mtk_np");
And my model :
function simpan($data)
$this->db->insert("nilai_tutorial", $data);
[ad_2]
لینک منبع