正确使用AJAX的方法

To fire some DataBase queries (not getting any value to load into some tag), I am using AJAX in the following way :

<script>
/* f() Called on any textBox/textArea value changed */
function f()
{

...///
xmlhttp.onreadystatechange=function()
  {
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    //simply to call a jsp page
    document.getElementById("myDivWasteHidden").innerHTML=xmlhttp.responseText;
    }
  }
//....
xmlhttp.open("GET","myJSP?var1=somePara",true);
}

</script> 

myJSP:

<%  

String comnt= request.getParameter("somePara");
//DB connection...
...

 PreparedStatement ps = conn.prepareStatement( 
"SELECT  QNO from BLOG where QNAME=?" );
     ps.setString( 1, qname );
..query 2..
some more operations...
some insert statements 

%>

This way I can get my job done.But :

1) Is this way Ok?

2) xmlhttp.responseText is responding so many times .Even The queries are fired many times why?

3)Now I have to load dynamically created div's on page load.Is this a good way to achieve this?