Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Newbie to XML - problem using xmlhttp >Thread Next - Re: Newbie to XML - problem using xmlhttp Re: Newbie to XML - problem using xmlhttpTo: NULL Date: 6/4/2007 4:16:00 PM
Tim Platt wrote:
> Until now I have not had any reason to learn about XML. I have spent
> quite a few hours playing with examples and reading group discussions
> like these - with a certain amount of success. However, I have a
> specific task to accomplish, and so far I have fallen at the last
> hurdle.
>
> I want to display the following 'feed' from an external server on our
> clients:
>
> http://www.q3.hpi.co.uk/servlet/HpiGate1_0?forward=YES&efxid=0502863&password=testing&initials=tp&function=SEARCH&vrm=V110ABE&XML=YES&product=HPI11&deviceType=XM
Inside of the browser your script can only connect back to the server
the HTML document with the script was loaded from.
> xmlhttp.onreadystatechange=onResponse;
> xmlhttp.open("GET",url,true);
> xmlhttp.setRequestHeader("Content-Type","text/xml")
> xmlhttp.send(null);
The HTTP reqest header Content-Type should be set if you do a POST or
PUT request and send a request body. As you do a GET request which does
not have any request body it does not make sense to set the Content-Type
request header.
> document.getElementById('A1').innerHTML=xmlhttp.status;
> document.getElementById('A2').innerHTML=xmlhttp.statustext;
> document.getElementById('A3').innerHTML=xmlhttp.responsetext;
JavaScript is case sensitive so it should be statusText and responseText.
> var response = xmlhttp.responseXML.documentElement;
For responseXML to be populated the response the server sends should
have Content-Type application/xml or text/xml but that server does not
send that header value so responseXML is not being populated.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
