it is still submitting page even though I clicked on Cancel in confirm box
<p>Hi below I have a submit button  and a jquery function it performs when the submit button is clicked on:</p>

<pre><code>&lt;p&gt;&lt;input id="submitBtn" name="submitDetails" type="submit" value="Submit Details" onClick="return myClickHandler();" /&gt;&lt;/p&gt;

&lt;script type="text/javascript"&gt; 
function myClickHandler()
{
     if (validation())
     {
         showConfirm();
         return true;
     }

     return false;
}
&lt;/script&gt;
</code></pre>

<p>Now as you can see if the validation() function is met, then it will perform the showConfirm() function and this function will perform the confirmation box which is below:</p>

<pre><code>function showConfirm()
{
    var confirmMsg=confirm("Make sure that your details are correct, once you proceed after this stage you would not be able to go back and change any details towards Questions, Options and Answers for your Assessment." + "\n" + "\n" + "Are you sure you want to Proceed?" + "\n" );

    if (confirmMsg == true)
    {
        submitform(); 
        return true;  
    }
    else
    {
        return false;
    }
}

function submitform()
{
    var fieldvalue = $("#QandA").val();
    $.post("insertQuestion.php", $("#QandA").serialize(), function(data)
    {
        var QandAO = document.getElementById("QandA");
        QandAO.submit();
    });  
    alert("Your Details for this Assessment has been submitted"); 
}
</code></pre>

<p>My question is this. If the user clicks on OK in the confirmation box, then it submits the page which is fine. But if the user clicks on Cancel, then it should not submit the page. The problem is that it is submitting the page even though the Cancel button has been clicked on. Why is this? </p>

<p>UPDATE:</p>

<p>I have tried this code below but still no luck:</p>

<pre><code>function myClickHandler()
{
     if(validation())
     {
         return showConfirm();
     }

     return false;
}
</code></pre>
