试试这个:
var jenis_submit = document.getElementById('jenis_submit');
var submit_url = '';
if (jenis_submit == '1') {
submit_url = "func_save_instansi";
} else if(jenis_submit == '2') {
submit_url = "func_update_instansi";
}
var post_url = '<?php echo base_url('Master_data'); ?>' + '/' + submit_url;
$.ajax({
type: "POST",
url: post_url,
data: dataKirim,
beforeSend: function() {
// you can show a preloader here
}
}).done(function(data) {
// hide the preloader
// console.log(data);
$('#notif').html(data);
}).fail(function() {
// hide the preloader
// show an error message
});