[OpenLayers-Users] Problem with requests in Opera and Chrome
Martin Leginus
martin.leginus at gmail.com
Wed Mar 18 06:28:08 EDT 2009
Hello
I would like to ask, I have problem with requests in Opera or Chrome. I was
trying OpenLayers.loadURL(url, '','', ParseXMLResponse),
OpenLayers.Request.GET ({ url:url, callback:ParseXMLResponse} ). Returned
XMLHttpRequest (responseXML) it's not correct in Opera and Google Chrome. In
Firefox and Explorer works everything fine.
Another way that I tried was reading via
OpenLayers.Format.XML.read(response.responseText) but the same result in
Opera and Chrome
I don't know if I am doing some mistake or problem is in OpenLayers
Could you help me please?
My code is bellow
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Problem in Opera</title>
<script type="text/javascript" src="./OpenLayers2.7.js.gz"></script>
<script type="text/javascript">
function ParseXMLResponse (response) {
// response.responseXML it's not correct in Opera or Safari, in Internet
Explorer and Mozilla Firefox everything works fine
var xmldoc = response.responseXML;
var root = xmldoc.getElementsByTagName('wfs:FeatureCollection').item(0);
if (root != undefined) {
document.getElementById('response').innerHTML += "Amount of
childNodes is" + root.childNodes.length;
}
// I was trying as well reading via
OpenLayers.Format.XML.read(response.responseText) but the same result in
Opera and Chrome
// var citac = new OpenLayers.Format.XML();
// xmldoc=citac.read(response.responseText);
// root = xmldoc.getElementsByTagName('wfs:FeatureCollection').item(0);
// if (root != undefined) {
// document.getElementById('response').innerHTML += "<br />Amount of
childNodes is(read via OpenLayers.Format.XML.read(response.responseText))" +
root.childNodes.length;
// }
if (root==undefined) {
document.getElementById('response').innerHTML += "<br />ResponseXML
is incorrect"
}
}
function request() {
var url = 'orawfs?x=-551890&y=-1222710&r=64.0&table=senica_parcela';
// Request OpenLayers.loadURL(), I also tried OpenLayers.Request.GET()
/POST()
OpenLayers.loadURL(url, '',"", ParseXMLResponse);
}
request();
</script>
</head>
<body>
<p id="response" >XML REQUEST</p>
</body>
</html>
I attached screenshots from Firefox (from Firebug) and Opera (Dragonfly) -
object responseXML
http://n2.nabble.com/file/n2496348/firefox_xmldoc.jpg
http://n2.nabble.com/file/n2496348/opera_response.responseXML_xmldoc.jpg
--
View this message in context: http://n2.nabble.com/Problem-with-requests-in-Opera-and-Chrome-tp2496348p2496348.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list