questo è un esempio di funzioni che uso per ajax

Codice PHP:
var xmlHttp

function showsection(str){

xmlHttp=GetXmlHttpObject()

var 
url="content.php?section="+str;

xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);


function 
stateChanged() 
{     

if (
xmlHttp.readyState==4){
    
###
}

la classica gif "loader" dove va messa? ho provato con if(xmlHttp.readyState<4) non funge