Skip to content

Instantly share code, notes, and snippets.

@bertt
Created August 16, 2012 20:21
Show Gist options
  • Save bertt/3373320 to your computer and use it in GitHub Desktop.
Save bertt/3373320 to your computer and use it in GitHub Desktop.
geoserver jquery request with and without jsonp
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
<script type="text/javascript">
// zonder jsonp
$.getJSON('rest/agn/gebouwen?wkt=POINT(234403 579310)', function (data) {
alert("data: " + data);
});
// met jsonp
$.ajax({
type: 'GET',
url: 'http://www.geoserver.nl/rest/agn/gebouwen?wkt=POINT(234403 579310)',
async: false,
jsonpCallback: 'jsonCallback',
dataType: 'jsonp',
success: function (data) {
alert("data:" + data);
},
error: function (e) {
console.log(e.message);
}
});
</script>
</head>
<body>
</body>
</html>
@angelogarzon
Copy link

excellent, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment