<script LANGUAGE="JavaScript"> function confirmSubmit() { jConfirm('Is the Appointment Confirmed?', 'Confirmation Dialog', function(r) { if(r){return true;} else {return false;} }); } </script> <form name='cancel_form'id='cancel_form' method='POST' action=""> <center><input type='submit' name='confirm_appointment' value='Cancel Appointment' onclick='return confirmSubmit();'></center> </form>
<script type='text/javascript'> var ajax_load = "<img class='loading' src='img/load.gif' alt='loading...' />"; var saveUrl = "<?php echo $this->url(array('controller' => 'appointment', 'action' =>'cancelsave'));?>"; $('#cancel_form').ajaxForm({ success: saveCallbk , url : saveUrl }); function saveCallbk(responseText) { jAlert(responseText,'Alert Dialog'); if(responseText.indexOf("ERROR")<0) { $(location).attr('href',redirectUrl); } } </script>
when I submit the form I call this function and use jConfirm from jquery. I print r. It's printing properly like true and false, but return false or return true has no effects. It just shows the pop up and submits the form, does not wait for confirmation. How to solve this?