I have something like that in my code:
<?php foreach($clients as $client): ?>
<tr class="tableContent">
<td onclick="location.href='<?php echo site_url('clients/edit/'.$client->id ) ?>'"><?php echo $client->id ?></td>
<td><a class='Right btn btn-danger' onClick="ConfirmMessage('client', <?php $client->id ?>,'clients')">
<i class="icon-remove-sign icon-white"></i>
</a></td>
</tr>
<?php endforeach ?>
that's actually the view. So when the user click on the delete button (thr one with the btn-danger class) I'd like him to confirm his choice with a javascript confirmation box message. You can find that script in the header
<script>
function ConfirmMessage(type, id, types) {
if (confirm("Are you sure you want to delete this ",type," ?")) { // Clic sur OK
document.location.href='<?php echo site_url(); ?>',types,'/delete/',id;
}
}
</script>
So here is my question:
I would like the $type to be replaced by a paramenter (like client, article, post .. ) that I'll pass to the function. And i would like to get the $client-id parameter as well.
I'm bad in javascript and as you already have guess, It is obviously not working at all.