Código PHP:
Ver original
<form name="accept_req" action="<?php echo site_url('viajar/accept'); ?>" method="post"> <input type="checkbox" id="block_date" name="block_date" /> <textarea name="comment" id="comment"></textarea> <input type="hidden" id="checkin" name="checkin" value="12" /> <input type="hidden" id="checkout" name="checkout" value="13" /> <input type="button" class="accept_button" name="accepted" value="Aceptar" onclick="javascript:req_action('accept');" /> </form> <form name="decline_req" action="<?php echo site_url('viajar/decline'); ?>" method="post"> <input type="checkbox" name="block_date2" /> <textarea name="comment2" id="comment2"></textarea> <input type="hidden" id="checkin" name="checkin" value="12" /> <input type="hidden" id="checkout" name="checkout" value="13" /> <input type="button" class="decline_button" name="decliend" value="Rechazar" onclick="javascript:req_action('decline');" /> </form>
Código Javascript:
Ver original
function req_action(id) { if(id == "accept") { var is_block = $("#block_date").val(); var comment = $("#comment").val(); }else{ var is_block = $("#block_date2").val(); var comment = $("#comment2").val(); } var checkin = $("#checkin").val(); var checkout = $("#checkout").val(); var ok=confirm("Esta seguro que desea hacer la operacion?"); if(!ok) { return false; }