I am trying to read the xml file that is retrieved with AJAX, I want to read the coordinates of the file. Below I show the function that creates the ajaxrequest object and the ajax call to the server. IE sends me the message error "object null" in the line where the "for" starts.

I dont know what the problem is. Any idea?

Thank you for your help.

function ajaxcoord(){
var ajaxRequest; // The variable that makes Ajax possible!

// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
}catch (e){
// Internet Explorer Browsers
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
//alert("Your browser broke!");
return false;

// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var xml = ajaxRequest.responseXML.documentElement;
for (i = 0; i < xml.getElementsByTagName('SRS name').length; i++){
var item = xml.getElementsByTagName('CTS_Response')[i];
var txt = item.getElementsByTagName('COORDS values')[0].firstChild.data;
ajaxRequest.open("GET","https://upd.geodatenzentrum.de/cts/server?REQUEST=GetCoordinates&FROMSRS=GEO84&TOSRS= GK3&COORDS=10 50 11 51",true);