I am trying to get response from GetFeatureInfo of sample WMS. But getting "Unable to load http://ogi.state.ok.us/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&SRS=EPSG:4326&BBOX=-104.5005,32.7501,-94.01,37.20&WIDTH=800&HEIGHT=300&LAYERS=ogi:okcounties&QUERY_LAYERS=ogi:okcounties&STYLES=&X=550&Y=105& status: 0"
var httpurl = "http://ogi.state.ok.us/geoserver/wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&SRS=EPSG:4326&BBOX=-104.5005,32.7501,-94.01,37.20&WIDTH=800&HEIGHT=300&LAYERS=ogi:okcounties&QUERY_LAYERS=ogi:okcounties&STYLES=&X=550&Y=105&";
try {
require(["dojo/request"], function (request) {
var promise = request(httpurl);
promise.response.then(
function (response) {
var kk = response;
},
function (error) {
var kk = error;
}
);
});
} catch (ex) {
alert(ex.message);
}
I see a couple potential issues:
Based on the request documentation , I think you should call .then()
directly on your promise. Lke this:
promise.then(...);
on this line: var kk = data;
... you're using the variable data
but you should be using response
.
You may be getting a CORS issue - is your code running on the same domain as that URL? If not, and the website owner does not want to enable CORS for your domain, you may need to run a CORS proxy (google it)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.