Jump to content

ajax


abdelelbouhy

Recommended Posts

hello guyscan you tell me why this code doesn't work it create the object just fine but the onreadystatechange doesn't i tried by using alert() it seems like no request been done ajax.xml file is in the same folder with the .html which made the requestplease helpfunction getDoc(){if(window.XMLHttpRequest){ request = new XMLHttpRequest();}else if(window.ActiveXObject){ request = new ActiveXObject("Microsoft.XMLHTTP");}if(request){request.open("GET", "ajax.xml", true);request.onreadystatechange = function(){ if(request.readyState == 4 && request.status == 200){ alert('doc ok'); var response = request.responseXML; }request.send(null);} /*document.getElementById('display').innerHTML = response;*/}}</script></head><body><p id="display"></p><form><input type="button" value="request" onclick="getDoc()"/></body></html>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...