title: Jquery Datepicker onselect call function
body: <p>This is a function I need to call when my JQuery date picker selects both to and from dates:</p>
  
  <pre><code>function showUser() {
      // Retrieve values from the selects
      var DateFrom = document.getElementById('DateFrom').value;
      var DateTo = document.getElementById('DateTo').value;
  
  
      if (dtd=="" || dtm == "" || dfd == "" || dfm == "") {
          document.getElementById("txtHint").innerHTML="";
          return;
      }
  
      if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
          xmlhttp=new XMLHttpRequest();
      } else {// code for IE6, IE5
          xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
  
      xmlhttp.onreadystatechange=function() {
          if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200) {
              document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
          }
      }
  
      xmlhttp.open("GET","/StreetHailDrivers.php?DateFrom="+DateFrom+"&amp;DateTo="+DateTo,true);
      xmlhttp.send();
  }
  </code></pre>
  
  <p>and this is my datepicker:</p>
  
  <pre><code>  $(function() {
      $('.datepicker').datepicker({ onSelect: showUser(), minDate: -90, maxDate: "+1D" });
    });
  </code></pre>
  
  <p>If i take out the <code>onSelect: showUser()</code> The datepicker works fine, but doesnt post the data, but if i include the onselect the datepicker doesnt work. no drop down.</p>
  
  <p>I also tried the onchange event in the html:</p>
  
  <pre><code> &lt;input type="text" class="datepicker"  name="DateTo" id="DateTo" onchange="showUser()" /&gt; 
  </code></pre>
  
  <p>what should I do to get it working?</p>