Today I'm trying to use jquery ajax in codeigniter. I got a problem. The ajax code was in js file which included at the bottom of view
<script scr="<?php echo base_url() ?>assets/js/ajax_main.js"></script>
And inside the ajax_main.js
$.ajax({
type : 'GET',
url : "<?php echo base_url() ?>akun_baru?selectedRow="+id_row,
encode : true
})
.done(function(status) {
alert(status)
});
When I write
alert("<?php echo base_url() ?>")
Sure it just shows <?php echo base_url() ?>
I just thinking that maybe I need to transfer the value of base_url() to be saved in javascript. But how?