IE ajax problem [modified]
-
Anyone have any ideas why I get a "The data necessary to complete this operation is not yet available." error in IE? Edit: I'm pretty sure it has something to do with the file not being text.
function http (m, u, d, f) { var r = null; if (window.XMLHttpRequest) { r = new XMLHttpRequest(); if (r.overrideMimeType) { r.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { try { r = new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) { try { r = new ActiveXObject('Microsoft.XMLHTTP'); } catch(e){} } } if (r) { r.onreadystatechange = function() { if (r.readyState == 4) { alert(r.readyState); //This is 4 when the error occures if (r.status == 200) { **f(r.responseText);** //ERROR here "The data necessary to complete this operation is not yet available." } } }; r.open(m, u, true); r.setRequestHeader('Connection', 'close'); if (d) r.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); r.send(d); } } var df=document.getElementsByTagName("PARAM")[0].value; http('GET','http://example.net/'+df,'', function(data){alert(data);});
-- modified at 18:54 Friday 27th April, 2007 -
Anyone have any ideas why I get a "The data necessary to complete this operation is not yet available." error in IE? Edit: I'm pretty sure it has something to do with the file not being text.
function http (m, u, d, f) { var r = null; if (window.XMLHttpRequest) { r = new XMLHttpRequest(); if (r.overrideMimeType) { r.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { try { r = new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) { try { r = new ActiveXObject('Microsoft.XMLHTTP'); } catch(e){} } } if (r) { r.onreadystatechange = function() { if (r.readyState == 4) { alert(r.readyState); //This is 4 when the error occures if (r.status == 200) { **f(r.responseText);** //ERROR here "The data necessary to complete this operation is not yet available." } } }; r.open(m, u, true); r.setRequestHeader('Connection', 'close'); if (d) r.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); r.send(d); } } var df=document.getElementsByTagName("PARAM")[0].value; http('GET','http://example.net/'+df,'', function(data){alert(data);});
-- modified at 18:54 Friday 27th April, 2007yes, you use a different property to responseText, to get access to the document root node of the XML that you're being returned. var xml = req.responseXML.documentElement; This gives you the root node, in an XML DOM document.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
yes, you use a different property to responseText, to get access to the document root node of the XML that you're being returned. var xml = req.responseXML.documentElement; This gives you the root node, in an XML DOM document.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
Thanks for the reply but by not text I meant some text mixed with a few nulls and some group separators followed by a block of a few hundred capital letters (what I was trying to extract). Anyway ,it works in firefox and I guess thats good enough for me. Now why does everything I write not work in IE.
-
Thanks for the reply but by not text I meant some text mixed with a few nulls and some group separators followed by a block of a few hundred capital letters (what I was trying to extract). Anyway ,it works in firefox and I guess thats good enough for me. Now why does everything I write not work in IE.
Funny, nothing I write works in FF :P
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Funny, nothing I write works in FF :P
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
So then we can agree that a conclusion of "Nothin Works" is pretty easy to draw...
Brad Australian - URGENT URGENT PLZ READ B4 OTHERS VERY URGENT NO TIME WASTERS on "URGENT URGENT PLZ READ B4 OTHERS VERY URGENT NO TIME WASTERS " 1) do not use lower characters. They are just too small 2) do not give any error message, the expert will know what the problem is 3) do not come back to read the answer 4) do not say thanks 5) urge the readers as much as possible. Do not hesitate to write urgent as often as possible 6) do not explain what you are trying to achieve, the query is self-explaining 7) do not post create table statements, it is unnecessary to understand the problem 8) affirm that you know everything very well 9) never never never read the doc, it will waste your time 10) confirm to those who do not know it yet that MS Access is far better than Oracle
-
Anyone have any ideas why I get a "The data necessary to complete this operation is not yet available." error in IE? Edit: I'm pretty sure it has something to do with the file not being text.
function http (m, u, d, f) { var r = null; if (window.XMLHttpRequest) { r = new XMLHttpRequest(); if (r.overrideMimeType) { r.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { try { r = new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) { try { r = new ActiveXObject('Microsoft.XMLHTTP'); } catch(e){} } } if (r) { r.onreadystatechange = function() { if (r.readyState == 4) { alert(r.readyState); //This is 4 when the error occures if (r.status == 200) { **f(r.responseText);** //ERROR here "The data necessary to complete this operation is not yet available." } } }; r.open(m, u, true); r.setRequestHeader('Connection', 'close'); if (d) r.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); r.send(d); } } var df=document.getElementsByTagName("PARAM")[0].value; http('GET','http://example.net/'+df,'', function(data){alert(data);});
-- modified at 18:54 Friday 27th April, 2007Sounds suspiciously like a problem with your response headers. Hopefully you have some control over the server sending this response; either way, i'd break out a good HTTP reference and start looking for inconsistencies...
----
It appears that everybody is under the impression that I approve of the documentation. You probably also blame Ken Burns for supporting slavery.
--Raymond Chen on MSDN
-
Sounds suspiciously like a problem with your response headers. Hopefully you have some control over the server sending this response; either way, i'd break out a good HTTP reference and start looking for inconsistencies...
----
It appears that everybody is under the impression that I approve of the documentation. You probably also blame Ken Burns for supporting slavery.
--Raymond Chen on MSDN
yah i was going to say it sounds very much like something is going wrong with the headers such that the httprequest object thinks it has complete data but doesn't really ... could also be the null values causing a mismatch between what the request is saying it has sent and the data length the client thinks it got
"there is no spoon" {me}