title: refresh single select box on click with jquery
body: <p>I've a select populated by a php query, that loads the nicknames of the users logged in a specific div, called “UserList”.</p>
  
  <pre><code>&lt;div id=”UserList” name=”UserList”&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This select is placed in a php page, “userlist.php”, loaded by jquery. The php query works fine, so I've avoided writing here the db connection.</p>
  
  <pre><code>&lt;select name="User" id=”User”&gt;
  &lt;?  
  $MySql = "SELECT Name FROM Users WHERE Loc = '$Loc' ORDER BY Name";
  $Result = mysql_query($MySql);
  while ($rs = mysql_fetch_array($Result)) {
      echo '&lt;option value="'.$rs['Name'].'"&gt;'.htmlspecialchars($rs['Name']).'&lt;/option&gt;';
  }
  $rs-&gt;close;
  mysql_free_result($Result); ?&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>My problem is that I need to reload only the select and refreshing it when a user clicks the select itself, so new users that enter the page are added by the php query and those that changed page are removed from the list. But whit every event that I tried the jquery loops, instead of activating the reload only once every time a user clicks the form and the first click event not even reload properly the php query.</p>
  
  <pre><code>&lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  $(document).ready(function() {
  
  $("#UserList").load('userlist.php');
  
  $("#UserList").click(function() {
      $("#UserList").load('userlist.php');
      evt.preventDefault();
  });
  
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Thanks for your help.</p>