carlitos_way
12-15-2008, 11:55 AM
Hi All,
I'm working on a web-app that, by using ajax, make a request to a server and receives an XML that is used to draw a table on the browser, containing all the result received.
The function I built works greatly on FF, but at the moment gives me a problem on IE6/7.
I think, but I'm not sure, that the problem is that my javascript starts parsing the xml before all the response is downloaded, causing me the error.
I think this because at the start of my function I make a 'result.getElementsByTagName('Result')' and I check for its length, receiving '0' as length; and when accessing 'resultNode[0].getAttribute('xxxxxx')' it throws me an error:
function BuildXMLResults(){
var destination = 'ErrorResult'; // dove mostrare il valore di errore
if(reqXML.readyState == 4){
if(reqXML.status == 200){
var result = reqXML.responseXML;
var errorValue = '', responseValue = '';
var resultNode = result.getElementsByTagName('Result');
if (resultNode) {
alert('length: ' + resultNode.length + ' error: ' + resultNode[0].getAttribute('Error'));
errorValue = resultNode[0].getAttribute('Error');
responseValue = resultNode[0].firstChild.nodeValue;
}
errorValue == 0?$(destination).innerHTML = 'Operazione eseguita correttamente.':$(destination).innerHTML = responseValue;
...
...
I just used Fiddlr to check for the integrity of the response, and it says that the xml received is correct. This is the sample xml I receive:
<?xml version="1.0"?>
<DocWeaver Version="3.1.86b"><Result Error="0">Operazione eseguita correttamente.</Result><Values>.....</Values></DocWeaver>
As I was thinking that the problem was the result being parsed before being completely downloaded, I choosed to make a synchronous call to get it (instead of making an asynchronous one), but after that I still get the same error...
Can you give me any idea of what could be or what I should look for to understand the problem?
Thanks
regards
CB
I'm working on a web-app that, by using ajax, make a request to a server and receives an XML that is used to draw a table on the browser, containing all the result received.
The function I built works greatly on FF, but at the moment gives me a problem on IE6/7.
I think, but I'm not sure, that the problem is that my javascript starts parsing the xml before all the response is downloaded, causing me the error.
I think this because at the start of my function I make a 'result.getElementsByTagName('Result')' and I check for its length, receiving '0' as length; and when accessing 'resultNode[0].getAttribute('xxxxxx')' it throws me an error:
function BuildXMLResults(){
var destination = 'ErrorResult'; // dove mostrare il valore di errore
if(reqXML.readyState == 4){
if(reqXML.status == 200){
var result = reqXML.responseXML;
var errorValue = '', responseValue = '';
var resultNode = result.getElementsByTagName('Result');
if (resultNode) {
alert('length: ' + resultNode.length + ' error: ' + resultNode[0].getAttribute('Error'));
errorValue = resultNode[0].getAttribute('Error');
responseValue = resultNode[0].firstChild.nodeValue;
}
errorValue == 0?$(destination).innerHTML = 'Operazione eseguita correttamente.':$(destination).innerHTML = responseValue;
...
...
I just used Fiddlr to check for the integrity of the response, and it says that the xml received is correct. This is the sample xml I receive:
<?xml version="1.0"?>
<DocWeaver Version="3.1.86b"><Result Error="0">Operazione eseguita correttamente.</Result><Values>.....</Values></DocWeaver>
As I was thinking that the problem was the result being parsed before being completely downloaded, I choosed to make a synchronous call to get it (instead of making an asynchronous one), but after that I still get the same error...
Can you give me any idea of what could be or what I should look for to understand the problem?
Thanks
regards
CB