javascript - how to show return answer from return confirm -
how show alert result javascript return confirm()
?
the script this:
<td width="25" align="center" title="delete"> <?php echo '<a href="'.base_url().'index.php/ticket_controller/confirm_hr_ticket/'.$row->id.'" onclick="return confirm(\'are sure delete '.$row->trans_code.'?\')">'?> <img style="vertical-align:middle;"src="<?php echo site_url() . 'images/btn_delete.gif'; ?>"></img></a></td>
i want show alert('data deleted')
after click yes in confirmation.
you need make function called onclick like
html/php
<?php echo '<a href="'.base_url().'index.php/ticket_controller/confirm_hr_ticket/'.$row->id.'" onclick="return myfunction(\''.$row->trans_code.'\')">'?>
javascript
function myfunction(transcode){ if(confirm('are sure delete '+ transcode + '?')) { //delete data alert('data deleted'); return true; }else{ return false; } }
Comments
Post a Comment