I create an object using "xmlhttp = new XMLHttpRequest();", no problem. Then I have this script:
Expand|Select|Wrap|Line Numbers
- function getContent(file){
- if(file==""){ return; }
- xmlhttp.onReadyStateChange=stateChange();
- xmlhttp.open("GET",file,true); //async mode!
- xmlhttp.send(null);
- }//end function getComments
- function stateChange(){
- alert("state:"+xmlhttp.readyState);
- if (xmlhttp.readyState==4){ // the response is complete
- . . .
- var itm = xmlhttp.responseXML;
- var text=itm.getElementsByTagName("content")[0].xml;
- document.getElementById('xmlcontent').innerHTML=text;
- . . .
Expand|Select|Wrap|Line Numbers
- <form id="nulfrm" action="thispage.htm">
- <select name="past_comments" size="3" onchange="getContent(this.options[this.selectedIndex].value);">
- <option value="" selected>-- Select a topic from below --</option>
- <option value="test1.xml" >Test</option>
- <option value="test2.xml">Other test</option>
- </select>
- </form>
- <div id="xmlcontent"></div>
I think it must be an XMLHTTP issue since I am expecting more alerts than appear. But I am prepared to be wrong. Any help is appreciated.