Here is my situation:

I some chart software which expects some xml and uses javascript to get it:

Code:
chartObj.setDataXML(generateXML(yr));
I have changed the generateXML function to use ajax to get the xml. The page the xml comes from does several things:

1, it creates some xml from xml run though xsl. This is then stored as a string in a javascript var: strXML
2, it opens the resulting xml and sets some others vars which i want to use to change innerHTML on my main page (chart titles, date ranges etc)
3, it creates a table of data to go with the chart (for accessibility), which will also go on the page via innerHTML.

here is my generateXML function:

Code:
function generateXML(yr){
	var strXML;
	var xmlHttp;
	var urlStr
	try{
		xmlHttp=new XMLHttpRequest();
	}catch (e){
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}catch (e){
			try{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}catch (e){
				alert("Your browser does not support AJAX!");
				return false;
			}
		}	
	}
	
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){
			strXML=xmlHttp.responseText;
    	}
	}
	
	urlStr="xmldata_ajax.asp"+(MM_jumpMenu(yr))

	xmlHttp.open("GET",urlStr,true);
	xmlHttp.send(null);
	
	return strXML;	
}
this works for the xml, but i have several problems:

1, i would like to put the 'return strXML' in the 'readyState' statement, so it only returns when ready, but it stops working if i do this.
2, on the page which AJAX calls, i have used response.write (vb, classic asp) to write out a javascript innerHTML= to change the titles but nothing happens (it may be better to return this as a var and get my page to do the work?)

I am very new to AJAX and basically need some guidance.

If you've read this far thank

cheers

monkey