title: Changing from onclick to onchange doesn't work
body: <p>I need to make a form which auto populates other fields when user selects an option from dropdown. Doing lots of search here, made such a code:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form method="POST" action="form-ajax.php"&gt;
  &lt;label for="username"&gt;Username: &lt;/label&gt;
  &lt;select name="username" id="username"&gt;&lt;option value="user1"&gt;user1&lt;/option&gt;&lt;option value="user2"&gt;user2&lt;/option&gt;&lt;option value="user3"&gt;user3&lt;/option&gt;&lt;/select&gt;
  &lt;button id="fetchFields"&gt;fetch&lt;/button&gt;
  &lt;label for="posts"&gt;Posts: &lt;/label&gt;
  &lt;input type="text" size="20" name="posts" id="posts"&gt;
  &lt;label for="joindate"&gt;Joindate: &lt;/label&gt;
  &lt;input type="text" size="20" name="joindate" id="joindate"&gt;
  &lt;p&gt;&lt;input type="submit" value="Submit" name="submitBtn"&gt;&lt;/p&gt;
  &lt;/form&gt;
  
  
  
  &lt;script type="text/javascript"&gt;
  $(document).ready(function() {
      function myrequest(e) {
          var name = $('#username').val();
          $.ajax({
              method: "POST",
              url: "autofill.php",
              dataType: 'json',
              cache: false,
              data: {
                  username: name
              },
              success: function( responseObject ) {
                  $('#posts').val( responseObject.posts );
                  $('#joindate').val(responseObject.joindate);
              }
          });
      }
  
      $('#fetchFields').click(function(e) {
          e.preventDefault();
          myrequest();
      });
  })
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I also have <code>autofill.php</code> file, which selects data from MySQL database and returns it using <code>json_encode</code>. Everything works well.</p>
  
  <p>However, I need fields to be auto populated when user selects an item from dropdown, so he doesn't need to click <code>fetch</code> button. So I naturally replaced <code>&lt;select name="username" id="username"&gt;</code> to:</p>
  
  <pre><code>&lt;select name="username" id="username" onchange="myrequest();"&gt;
  </code></pre>
  
  <p>However, that doesn't work. What else should I modify?</p>