> Hey Eric,
> Thanks for your reply. After doing some testing I found out that both
> (IE and FF) return OK. So the request is actually fully functional.
> However I did found out that the problem apparently has something to
> do with the var xmlDoc (which contains http_request.responseXML) in FF
> this works just fine but in IE it returns object expected.
> I myself don't see the problem, does anyone of you do?
> Thanks for the help so far.
> On Feb 3, 3:13 am, "Eric Pascarello" <alienf@gmail.com> wrote:
> > status and statusText
> > Eric
> > On 2/2/07, Yorian <yorianbenja@hotmail.com> wrote:
> > > Hi,
> > > At the moment I'm trying to get data from a different server, however
> > > since this is not possible when using ajax (if requesting xml) I have
> > > a script in php that does the request from my own server. When I do my
> > > ajax request in Firefox everything works and I can see the data which
> > > is returned by the request however it doesn't work in IE. My script:
> > > function makeRequest(d,e) {
> > > var http_request = false;
> > > if (window.XMLHttpRequest) { // Mozilla, Safari, ...
> > > http_request = new XMLHttpRequest();
> > > if (http_request.overrideMimeType) {
> > > http_request.overrideMimeType('text/xml');
> > > // See note below about this line
> > > }
> > > } else if (window.ActiveXObject) { // IE
> > > try {
> > > http_request = new ActiveXObject("Msxml2.XMLHTTP");
> > > } catch (e) {
> > > try {
> > > http_request = new ActiveXObject("
> > > Microsoft.XMLHTTP");
> > > } catch (e) {}
> > > }
> > > }
> > > if (!http_request) {
> > > alert('Giving up :( Cannot create an XMLHTTP instance');
> > > return false;
> > > }
> > > var url = 'the WORKING url here';
> > > http_request.onreadystatechange = function()
> > > { get_data(http_request); };
> > > http_request.open('GET', url, true);
> > > http_request.send(null);
> > > }
> > > function get_data(http_request) {
> > > if(http_request.readyState == 1){
> > > var body = document.getElementsByTagName('body')[0];
> > > var loading = document.createElement('p');
> > > var loadText = document.createTextNode('Loading...');
> > > loading.appendChild(loadText);
> > > loading.className = 'load';
> > > loading.style.position = 'absolute';
> > > loading.style.left = '50%';
> > > loading.style.top = '50%';
> > > loading.style.width = '150px';
> > > loading.style.display = 'block';
> > > loading.style.backgroundColor = '#fff';
> > > loading.style.borderColor = '#aaf';
> > > loading.style.borderStyle = 'solid';
> > > loading.style.borderWidth = '2px';
> > > loading.style.textAlign = 'center';
> > > loading.style.padding = '5px';
> > > loading.style.color = '#aaa';
> > > body.appendChild(loading);
> > > }
> > > if (http_request.readyState == 4) {
> > > var body = document.getElementsByTagName('body')[0];
> > > for(i = 0; i < body.childNodes.length; i++){
> > > if(body.childNodes[i].className == 'load'){
> > > node = body.childNodes[i];
> > > node.parentNode.removeChild(node);
> > > }
> > > }
> > > // for-statement below seems to be needed since it doesn't
> > > always
> > > work with one
> > > for(i = 0; i < body.childNodes.length; i++){
> > > if(body.childNodes[i].className == 'load'){
> > > node = body.childNodes[i];
> > > node.parentNode.removeChild(node);
> > > }
> > > }
> > > if (http_request.status == 200) {
> > > var xmlDoc = http_request.responseXML;
> > > var a = document.getElementById('a');
> > > var b = document.getElementById('b');
> > > var c = document.getElementById('c');
> > > a.value = xmlDoc.getElementsByTagName
> > > ('a')[0].firstChild.nodeValue;
> > > b.value = xmlDoc.getElementsByTagName
> > > ('b')[0].firstChild.nodeValue;
> > > changeInputStyles(a,'do');
> > > changeInputStyles(b,'do');
> > > } else {
> > > alert('There was a problem with the request.');
> > > }
> > > }
> > > }
> > > Can anybody tell me why it is not working in IE?
> > > Another question:
> > > Is there for IE something like there is for Firefox that shows the
> > > request and returned data and an error if something goes wrong? (It's
> > > an extension in FF)
XML syntax. If it's possible (and it should be) try loading the XML
file directly in IE and see whether it complains. If it does, you know
it's that, otherwise it's more likely to be your code.
Hi.
Sometimes char encoding (utf-8, euc-kr, and so on) can be a problem in
parsing XML format.
You'd better check it. :-)
Good luck.
Sun-Gi Hong
-----------------------------------------------Reply-----------------------------------------------
It isn't the XML, that should be fine, check it yourself:
http://ws.geonames.org/countrySubdivision?lat=47.03&lng=10.2
I might try using Json because of a few reasons but if possible I
would still like to get this working
On Feb 7, 9:11 am, "robotian" <sungi.h@gmail.com> wrote:
> Hi.
> Sometimes char encoding (utf-8, euc-kr, and so on) can be a problem in
> parsing XML format.
> You'd better check it. :-)
> Good luck.
> Sun-Gi Hong