Created
June 30, 2017 05:55
-
-
Save codingmiao/85bcb9682aa42fe57f1c2ea0b80dd3da to your computer and use it in GitHub Desktop.
openlayers跨域请求 geoserver wms点击
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map.on('click', function (evt) { | |
var viewResolution = (map.getView().getResolution()); | |
var url = pwLayer.getSource().getGetFeatureInfoUrl( | |
evt.coordinate, | |
viewResolution, | |
'EPSG:4326', | |
{'INFO_FORMAT': 'text/javascript'}); | |
$.ajax({ | |
url: url, | |
data: "", | |
dataType: "jsonp", | |
jsonpCallback:'parseResponse', | |
success: function (data) { | |
console.log(data); | |
}, | |
error: function () { | |
console.log("选取设备异常!"); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment