$.getJSON trigger select change event
<p>I'm trying to add categories to a drop down list using jQuery Ajax. When an option is selected I would like to load the subcategories.</p>

<p>The problem that I'm facing is that the addition of options to the drop down list by the Ajax function seems to trigger the change event as well. How can I avoid this or rewrite my code better in order to avoid this behavior?</p>

<p>Here's my code:</p>

<pre><code>categoryHelper.loadLevel1 = function () {

    // The control that needs to be filled with categories
    var $control = $("#select1");

    // This function runs $.getJSON() and fills the drop down list
    // with option elements
    fillDropDown(url, null, $control); 

    // When I select a value I want to run the function loadLevel2 which
    // takes the currently selected value from level 1 as parameter
    $control.change(categoryHelper.loadLevel2($control.val()));
};
</code></pre>

<p>Code for the fillDropDown:</p>

<pre><code>function fillDropDown(url, parameters, dropdown) {
///     all data has been loaded&lt;/param&gt;
    $.getJSON(url, parameters, function (data) {
        $(dropdown).empty();
        $(dropdown).append(createOption("", ""));
        $(data).each(function () {
            $(dropdown).append(createOption(this.value, this.text));
        });
    });
}
</code></pre>

<p>All help is appreciated!</p>
