title: Clear dropdownlist with JQuery
body: <p>I wrote this little function to fill a drop down list with data from the server.</p>
  
  <pre><code>function fillDropDown(url, dropdown) {
      $.ajax({
          url: url,
          dataType: "json"
      }).done(function (data) {
          // Clear drop down list
          $(dropdown).find("option").remove(); &lt;&lt;&lt;&lt;&lt;&lt; Issue here
          // Fill drop down list with new data
          $(data).each(function () {
              // Create option
              var $option = $("&lt;option /&gt;");
              // Add value and text to option
              $option.attr("value", this.value).text(this.text);
              // Add option to drop down list
              $(dropdown).append($option);
          });
      });
  }
  </code></pre>
  
  <p>I can then call the function in this way:</p>
  
  <pre><code>fillDropDown("/someurl/getdata", $("#dropdownbox1"))
  </code></pre>
  
  <p>Everything is working perfectly, except for the one line where I'm clearing old data from the drop down list. What am I doing wrong?</p>
  
  <p>Any tips that might help to improve this code are also highly appreciated.</p>