Created
August 16, 2012 20:21
-
-
Save bertt/3373320 to your computer and use it in GitHub Desktop.
geoserver jquery request with and without jsonp
This file contains hidden or 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
<!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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
excellent, thanks.