Abstracting the jquery dialog call to reduce bloat
<p>I'm looking to create an abstracted jquery dialog function that i pass parameters into to reduce my overall js bloat. My javascript is currently full of examples such as this:</p>

<pre><code>    $(".claim_issue_lb").click(function (e) {

    $(function () {

        $("#dialog-claim").dialog({
            resizable: false,
            height: 240,
            modal: true,
            buttons: {
                "Claim Issue": function () {
                    ProcessDealerAction("claim"); //function to be called upon success
                    $(this).dialog("close");
                },
                Cancel: function () {
                    $(this).dialog("close");
                }
            }
        });

    });
});
</code></pre>

<p>To address this, I created the following:</p>

<pre><code>function LoadDialog(target, height, confirm_button, function_call) {

$(target).dialog({
    resizable: false,
    height: height,
    modal: true,
    buttons: {
        confirm_button: function () {
            function_call;
            $(this).dialog("close");
        },
        Cancel: function () {
            $(this).dialog("close");
        }
    }
});
</code></pre>

<p>}</p>

<p>With the hopes of being able to reduce my dialog calls to the following example:</p>

<pre><code>$(".claim_issue_lb").click(function (e) {

    LoadDialog("#dialog-claim", 240, "Claim Issue", ProcessDealerAction("claim"));

});
</code></pre>

<p>It seems to be working well, except that the confirm dialog pops up and then runs itself without anyone clicking "Yes do it" or "Cancel", and then the dialog auto closes. </p>

<p>I'm not certain how to address this, or if my entire approach is flawed from the ground up.</p>
