title: How use ajax post when datepicker change date?
body: <p>Good afternoon</p>
  
  <p>Value in input change with datepicker ui.</p>
  
  <p>I want use ajax post when value in input will be change. </p>
  
  <p>For this i use script:</p>
  
  <pre><code>&lt;input type="text" name="date" class="datepicker" id="datepicker"&gt;
  
  $(".datepicker").datepicker({changeYear: true});
  
  $(".datepicker").on("change",function(){
  var date=$(this).val();
  $.post("test.php", {
  date:date
  },
  function(data){$('#testdiv').html('');$('#testdiv').html(data);
  });
  });
  </code></pre>
  
  <p>But ajax post query is executed with the old date.</p>
  
  <p>Datepicker does not have time change value in input.</p>
  
  <p>Tell me how to do query after datepicker change the date in the field?</p>
  
  <p>Me need:</p>
  
  <p>1) datepicker change the date;</p>
  
  <p>2) query should be send with new date.</p>