I'm trying to read the http-response by ajax request. As an echo-server I use a simple socket on my host. It returns http-response with XML in it. Just like this:
HTTP/1.1 200 OK
Date: Fri, 18 Nov 2011 03:16:22 GMT
Content-Length: 94
Connection: close
Content-Type: text/xml
got it. waiting for the next..
As a client I'm using the following ajax request:
<html>
<head>
<script type="text/javascript" src="jquery-1.5.1.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$.ajax({
url: "http://localhost:8090/",
dataType: "text",
complete: function(jqXHR, textStatus){
alert(textStatus);
alert(jqXHR.responseText);
}
});
});
</script>
</head>
<body>
</body>
</html>
After this script execution I receive the following error in FF:
XML Parsing Error: no element found Location: moz-nullprincipal:{62148931-591e-41d7-8625-c86149386fc4} Line Number 1, Column 1:
I can read the resulting XML without any error if I request it using address bar in FF, Chrome and IE, but this Ajax call returns error. It seems that I'm missing something working with ajax. Can you help me with this? Thank you.