jquery return false in form
<pre><code>&lt;script LANGUAGE="JavaScript"&gt;
function confirmSubmit() {
    jConfirm('Is the Appointment Confirmed?', 'Confirmation Dialog', function(r) {
        if(r) {
            return true;
        } else {
            return false;
        }
    });
}
&lt;/script&gt;

&lt;form name='cancel_form'id='cancel_form' method='POST' action=""&gt;
&lt;center&gt;
&lt;input type='submit' name='confirm_appointment' value='Cancel Appointment' onclick='return confirmSubmit();'&gt;
&lt;/center&gt;
&lt;/form&gt;

&lt;script type='text/javascript'&gt;
var ajax_load = "&lt;img class='loading' src='img/load.gif' alt='loading...' /&gt;";
var saveUrl = "&lt;?php echo $this-&gt;url(array('controller' =&gt; 'appointment', 'action' =&gt;'cancelsave'));?&gt;";
$('#cancel_form').ajaxForm({ success: saveCallbk , url : saveUrl });
function saveCallbk(responseText) {
    jAlert(responseText,'Alert Dialog');
    if(responseText.indexOf("ERROR")&lt;0) {
        $(location).attr('href',redirectUrl);
    }
}
&lt;/script&gt;
</code></pre>

<p>When I submit the form I call this function and use <code>jConfirm</code> from jQuery. I print <code>r</code>. It's printing properly (e.g. <code>true</code> and <code>false</code>), but <code>return false</code> or <code>return true</code> has no effect -- it just shows the pop up and submits the form, and does not wait for confirmation. How to solve this?</p>

<p>The ajaxForm plugin takes care of the submission by itself and it needs a submit button. If I use:</p>

<pre><code>function confirmSubmit() {
    var agree=confirm("Is the Appointment Cancelled?");
    if (agree) {
        return true;
    } else {
        return false;
    }
}
</code></pre>

<p>like default javascript it works well</p>
