Javascript isn't re-assigning variable second time function is called
<p>I have a little cunundrum. I have a Jquery/Js function that gets the item selected from a DropDownList. Then assigns it to a variable and the variable is passed to another function. The only problem I am having is, when I do it the first time, everything works. When I call the function a second time, the variables stay the same instead of being reassigned.</p>

<p>ddlCaseFilesNew, ddlCaseFilesOld, are my two DropDownLists.</p>

<p>Here is my function:</p>

<pre><code>function getCaseFiles(canMoveExpenses) {
        //create Popup with content from div
        var newCaseDdl = null;
        var oldCaseDdl = null;
        $('#ddlFiles').dialog({
            autoOpen: true,
            height: 'auto',
            width: 'auto',
            modal: true,
            buttons: {
                "Ok": function () {
                    //assign new CaseFile and old CaseFile for stored proc.
                    //var newCaseDdl = "";

                    newCaseDdl = $("#ddlCaseFilesNew").val();
                    alert("newCaseDdl = " + newCaseDdl);
                    //                      newCaseDdlInt = newCaseDdl.options[newCaseDdl.selectedIndex].value;

                    //var oldCaseDdl = "";
                    oldCaseDdl = $("#ddlCaseFilesOld").val();
                    //                        oldCaseDdlInt = oldCaseDdl.options[oldCaseDdl.selectedIndex].value;
                    alert("oldCaseDdl" + oldCaseDdl);
                    if (newCaseDdl != -1 &amp;&amp; oldCaseDdl != -1) {
                        moveCasefile(canMoveExpenses, newCaseDdl, oldCaseDdl);
                        $(this).dialog('close');
                    }
                    else {
                        showMessage("Error. Please Select a Value From The Lists.");
                    }
                    oldCaseDdl = $("#ddlCaseFilesOld").selectedIndex = -1;
                    newCaseDdl = $("#ddlCaseFilesNew").selectedIndex = -1;
                },
                Cancel: function () {
                    newCaseDdl = null;
                    oldCaseDdl = null;
                    $(this).dialog('close');
                }
            }
        });
    }
</code></pre>

<p>I am somewhat new to Js/JQuery</p>

<p>oldCaseDdl  and newCaseDdl  are the variables that need to chagne to the selected index of the DropDownList</p>
