将jQuery框架用于Ajax

First let me describe my situation:

I am about to create a form where each field will have a help button. Now if someone click on the help it will bring data from database and show those in a div. For example

<div class="main">
 <div class="form">
   <!-- my form code will be here-->
 </div>

 <div class="help">
   <!-- this div will show some data using ajax. I need to make database query using ID of help then show the data here-->
 </div>

</div><!--end of main-->

Now i read about ajax in w3 schools i found a solution there. Which is :

<script>
 function loadXMLDoc(a)
 {
 var xmlhttp;
 var temp = "myname.php?id=" + a;


 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("myDiv").innerHTML=xmlhttp.responseText;
        }
      }
 xmlhttp.open("GET",temp,true);
 xmlhttp.send();
}
</script>



<h2>AJAX</h2>
  <button type="button" onclick="loadXMLDoc('1')">Request 1</button>
    <button type="button" onclick="loadXMLDoc('2')">Request 2</button>
  <button type="button" onclick="loadXMLDoc('3')">Request 3</button>
<div id="myDiv"></div>

If i click on a button and send the id as parameter its works. After making some google search i found that it is better to use jQuery framework for ajax. Now i didn't get any beginner tutorials in Google about this.

Now if above code is ok to use in that case give me some link or help that how to make database query on Javascript and get the values and set it to a div using Ajax.

If this is not a good way to use Ajax then please give me some instruction that how can i use Ajax for getting values from database and show it in a particular div. Please keep in mind that i need to send the help ID on the function with whom i will make the database query.

I am using wordpress framework.

Include jquery.js in your page then it is as simple as

function loadXMLDoc(a) {
    $('#myDiv').load("myname.php?id=" + a);
}

If you want a complete jquery solution, then I would recommend using jquery event registration also like

HTML

<button type="button" class="requester" data-request="1">Request 1</button>
<button type="button" class="requester" data-request="2">Request 2</button>
<button type="button" class="requester" data-request="3"Request 3</button>
<div id="myDiv"></div>

JS

$(function() {
    $('.requester').click(function() {
        $('#myDiv').load("myname.php?id="
                + $(this).data('request'));
    });
});
$.post('myname.php',{id:a},function(data){ $('#myDiv').html(data); });