I have code javascript with tag php in one file, in footer.html exactly. The php tag is work for calling method in a controller using url. when I separate the JS from footer.php in files .js the tag php is not working.
<?php echo site_url('index.php/master_ekspor/ajax_edit/')?>/
How to add/use/put php function on .JS file?
This is my .js function ?
function edit_ekspor(id)
{
save_method = 'update_ekspor';
$('#form')[0].reset(); // reset form on modals
//Ajax Load data from ajax
$.ajax({
url : "<?php echo site_url('index.php/master_ekspor/ajax_edit/')?>/" + id,
type: "GET",
dataType: "JSON",
success: function(data)
{
$('[name="id_ekspor"]').val(data.id_ekspor);
$('[name="nm_industri"]').val(data.nm_industri);
$('[name="e_berat"]').val(data.e_berat);
$('[name="e_nilai"]').val(data.e_nilai);
$('[name="tahun"]').val(data.tahun);
$('#modal_form').modal('show'); // show bootstrap modal when complete loaded
$('.modal-title').text('Edit Data Ekspor'); // Set title to Bootstrap modal title
},
error: function (jqXHR, textStatus, errorThrown)
{
alertify.error("Gagal Mendapatkan Data");
}
});
}