By the way, I also wanted to check the response status and when I print out response.status it comes back 0 so the status is 0... not sure why the AJAX call would fail when the GET request using the browser bar works fine.<br>
<br>thank you<br><br>alessandro ferrucci<br><br><br><div class="gmail_quote">On Tue, Oct 27, 2009 at 3:41 PM, Alessandro Ferrucci <span dir="ltr"><<a href="mailto:alessandroferrucci@gmail.com">alessandroferrucci@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">hi, I actually in set the response to be HTML with "&INFO_FORMAT=text/html"<br>
<br>in fact the response type in the header is text/html in the request. I turned on firebug and I see the AJAX request and the response HTML is empty. However when I copy the URL and put it straight in the browser, it comes back with the correct HTML.<div>
<div></div><div class="h5"><br>
<br><div class="gmail_quote">On Tue, Oct 27, 2009 at 3:02 PM, Shawn Oatley <span dir="ltr"><<a href="mailto:shawn@niagarafalls.ca" target="_blank">shawn@niagarafalls.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style="margin: 4px 4px 1px; font-family: Segoe UI; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
<div>If you use Firefox and Firebug, you can watch the XML request go to / from the server. Chances are, it is returning an XML object not a text object. When this happens, responseText is empty and responseXML has your data.</div>
<div> </div>
<div>Shawn<div><div></div><div><br><br>>>> On 10/27/2009 at 2:18 PM, Alessandro Ferrucci <<a href="mailto:alessandroferrucci@gmail.com" target="_blank">alessandroferrucci@gmail.com</a>> wrote:<br>
</div></div></div><div><div></div><div>
<div style="border-left: 1px solid rgb(5, 5, 5); margin: 0px 0px 0px 15px; background-color: rgb(243, 243, 243); padding-left: 7px;">Hello,<br>I'm attempting to call getFeatureInfo from Openlayers to a geoserver instance.<br>
<br>Rigth now all I do is construct a GetFeatureInfo URL and supply that URL to a window.open method and it works fine, below is relevant code:<br><br>var wmsurl = "<a href="http://dialga.npc.census.gov:8080/geoserver/wms" target="_blank">http://dialga.npc.census.gov:8080/geoserver/wms</a>";<br>
<br>map.events.register('click', map, function (e) {<br>var url = wmsurl + "?REQUEST=GetFeatureInfo" + "&EXCEPTIONS=application/vnd.ogc.se_xml"<br>+ "&BBOX=" + map.getExtent().toBBOX()<br>
+ "&X=" + e.xy.x<br>+ "&Y=" + e.xy.y<br>+ "&INFO_FORMAT=text/html"<br>+ "&QUERY_LAYERS=cira:addresses"<br>+ "&LAYERS=cira:addresses"<br>+ "&FEATURE_COUNT=50"<br>
+ "&SRS=EPSG:900913"<br>+ "&STYLES="<br>+ "&WIDTH=" + map.size.w<br>+ "&HEIGHT=" + map.size.h;<br><br>window.open(url, "getfeatureinfo", "location=0,status=0,scrollbars=1,width=600,height=150" );<br>
});<br><br>But now I want to be able to use OpenLayers.loadURL method to make an AJAX request to the geoserver instance and get back the XMLHttpRequest obejct and extract the HTMl from the responseText member.<br><br>this is the code:<br>
<br>var wmsurl = "<a href="http://dialga.npc.census.gov:8080/geoserver/wms" target="_blank">http://dialga.npc.census.gov:8080/geoserver/wms</a>";<br><br>map.events.register('click', map, function (e) {<br>
var url = wmsurl<br>+ "?REQUEST=GetFeatureInfo"<br>+ "&EXCEPTIONS=application/vnd.ogc.se_xml"<br>+ "&BBOX=" + map.getExtent().toBBOX()<br>+ "&X=" + e.xy.x<br>+ "&Y=" + e.xy.y<br>
+ "&INFO_FORMAT=text/html"<br>+ "&QUERY_LAYERS=cira:addresses"<br>+ "&LAYERS=cira:addresses"<br>+ "&FEATURE_COUNT=50"<br>+ "&SRS=EPSG:900913"<br>+ "&STYLES="<br>
+ "&WIDTH=" + map.size.w<br>+ "&HEIGHT=" + map.size.h;<br><br>OpenLayers.loadURL(url,'',this,receiveGetFeatureInfo,receiveGetFeatureInfo);<br>});<br><br>function receiveGetFeatureInfo(response)<br>
{<br>alert("RESPONSE TEXT: " + response.responseText);<br>}<br><br>responseText is ALWAYS empty... am I doing something wrong?<br><br>Thank you very much,<br><br clear="all"><br>-- <br>Signed,<br>Alessandro Ferrucci<br>
</div></div></div></div>
</blockquote></div><br><br clear="all"><br></div></div>-- <br>Signed,<br><font color="#888888">Alessandro Ferrucci<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Signed,<br>Alessandro Ferrucci<br>