Prevent bootstrap modal from closing on submit button click
<p>I have a bootstrap modal.  When the user clicks the "Update" button it makes an ajax call to update the DB.  However if the update fails for some reason I want to display the error message and leave the modal open.</p>

<p>Everything appears to be working in the order I expect, however the <code>e.preventDefault()</code> doesn't appear to stop the modal from closing.</p>

<p>Why is the <code>preventDefault()</code> not stopping the button from submitting?</p>

<p>My button:</p>

<pre><code>&lt;button type="submit" class="btn btn-success" id="btnUpdate" style="margin-right:10px"&gt;Update&lt;/button&gt;
</code></pre>

<p>Javascript button click code.</p>

<pre><code>$("#btnUpdate").on("click", function (e) {
    // reset the message...
    $("#errorMessage").html("");

    // get the value...
    var myParam = $("#someSelection").attr("someData");
    var myParamData = JSON.parse(myParam );

    updateData(myParamData.Name)
    .done(function (result) {
        if (!result.d == "") {
            $("#errorMessage").html(result.d);
            e.preventDefault();
        }
        else {                     
          loadData();
        }
    });
});
</code></pre>