change ajax to jquery..

change ajax to jquery..

hello there jquery gurus...i have a ajax script that fetch information from a database..what i want is that i will implement this using jquery..i know it could possibly be done...will you please help me with this one..

for no reason i just want to use jquery aside from using ajax..

here's the sample script..
  1. function showUser(str)
    {
    var str;
    var url="http://myhotel.com/RegisterA/showHotels";
    url=url+"?q="+str;
    url=url+"&sid="+Math.random();

    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 && xmlhttp.status==200)
        {
        document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
        }
      }
    xmlhttp.open("GET",url,true);
    xmlhttp.send();
    }
























and the html form

  1. <form method="post" action='' ">
    Select a User:
    <select name="users" onchange="showUser(this.value)">
    <option value="1">Peter Griffin</option>
    <option value="2">Lois Griffin</option>
    <option value="3">Glenn Quagmire</option>
    <option value="4">Joseph Swanson</option>
    </select>
    </form>
    <br />
    <div id="txtHint"><b>Person info will be listed here.</b></div>