I have the following function that will show a pop up message, once the user click ok it will navigate the user to the controller called backendBanner and call the function delete_banner.
The link written in html and php looks something like this:
<a href="<?php echo base_url().'backendBanner/delete_banner/'.$banner['banner_path']; ?>">
Code for the button in view to call the function
<td>
<a onclick="return remove_image($(this));" rel="<?php echo $banner['banner_path']; ?>"><input type="button" class="btn btn-danger" value="Delete"></a>
</td>
Code for the function In this function, $banner['banner_path'] is equal to fullpath
<script>
function remove_image(img)
{
if(confirm('<?php echo lang('confirm_remove_image');?>'))
{
var fullpath = img.attr('rel');
alert(fullpath);
redirect(base_url()."backendBanner/delete_banner/"+fullpath);
}
}
</script>
How should I go about bringing the user to the link through the function?