title: AJAX - After success clean input value and set dropdown to selected
body: <p>I have a page with a dropdown list and a <code>input</code> with <code>type="text"</code>.</p>
  
  <p>I'm trying to filter the results of my table via AJAX when I select an option in my dropdown list.</p>
  
  <p>It should clean the value of the input when the option is selected (after the success).</p>
  
  <p>It's working fine.</p>
  
  <p>The problem is that I need it to for my input. It should send the value of the input to AJAX and then filter the results when I submit the form.</p>
  
  <p>I can't put it to work after the suceess. It sets the dropdown list to "selected". I don't know why.</p>
  
  <p>HTML code:</p>
  
  <pre><code>&lt;form action="@Url.Action("a","b")" id="filter-date" onsubmit="javascript:return false"&gt;   
      &lt;label for="from" class="label-datepicker"&gt;from:&lt;/label&gt;
      &lt;input type="text" id="from" name="from" class="dateinput"&gt;
      &lt;label for="to" class="label-datepicker"&gt;to:&lt;/label&gt;
      &lt;input type="text" id="to" name="to" class="dateinput"&gt;
      &lt;button type="submit" name="submit" id="submit-date"&gt;
          OK
      &lt;/button&gt;
  &lt;/form&gt;
  
  
  
  &lt;select name="Assunto" id="select-a"&gt;
      &lt;option value="" selected="selected"&gt;--Select--&lt;/option&gt;             
          &lt;option value="a"&gt;a&lt;/option&gt;
  &lt;option value="b"&gt;b&lt;/option&gt;
  &lt;option value="c"&gt;c&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>JavaScript code:</p>
  
  <pre><code>$("#select-a").change(function () {
          var selected = $("#select-a").val();
          var Keyword = { data: $("#select-a").val() };
          $.ajax({
              cache: false,
              type: 'GET',
              async: false,
              url: '@(Url.Action("bo", "b"))',
              data: { Keyword: selected },
              dataType: 'html',
              success: function (data) {
                  $(".dateinput").val('');
              },
              error: function (xhr, ajaxOptions, thrownError) {
                  alert(xhr.responseText);
              }
          });
      });
  
  $("#filter-date").submit(function () {
          var from = $("#from").val();
          var to = $("#to").val();
          $.ajax({
              cache: false,
              type: 'GET',
              async: false,
              url: '@(Url.Action("update", "b"))',
              data: { From: from, To: to },
              dataType: 'html',
              success: function (data) {
                  $("#bodylist").html(data);
                  $("#select-a").val(selected);
              },
              error: function (xhr, ajaxOptions, thrownError) {
                  alert(xhr.responseText);
              }
          });
      });
  </code></pre>