我想使用 ajax 发送到 saveKrs 并保存到数据库。我正在使用codeigniter,当我点击提交按钮时,没有任何事件。请帮我
form_checkbox('checkKrs[]',$row->id, FALSE, 'id=checkKrs')
<script type="text/javascript">
$('#save_krs').click(function(){
var id_student= $('#id_student').val();
var id_semester = $('#id_semester').val();
var checkKrs = new Array();
$("input:checked").each(function() {
data['checkKrs[]'].push($(this).val());
})
var data = {
checkKrs:checkKrs,
id_semester:id_semester,
id_mahasiswa:id_mahasiswa,
is_ajax: '1'
};
$.ajax({
url: "saveKrs",
type: 'POST',
data: data,
beforeSend : fnLoadStart,
complete : fnLoadStop,
success: function(msg) {
//$('#form_data').hide();
$('#form_data').html(msg);
//$('#report').show();
}
});
alert('Pengisian KRS tidak boleh kosong');
return false;
});
</script>