update the arcgiscache_jsonp example to use OpenLayers.Protocol.Script instead of the JSONP from jquery
git-svn-id: http://svn.openlayers.org/trunk/openlayers@12260 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -7,20 +7,17 @@
|
|||||||
<link rel="stylesheet" href="style.css" type="text/css">
|
<link rel="stylesheet" href="style.css" type="text/css">
|
||||||
|
|
||||||
<script src="../lib/OpenLayers.js"></script>
|
<script src="../lib/OpenLayers.js"></script>
|
||||||
<script src="../lib/OpenLayers/Layer/ArcGISCache.js" type="text/javascript"></script>
|
|
||||||
|
|
||||||
<!-- This is to simplify making the JSONP request for this example -->
|
|
||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var map,
|
var map,
|
||||||
layerURL = "http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer";
|
layerURL = "http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer";
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
var jsonp_url = layerURL + '?f=json&pretty=true&callback=?';
|
var jsonp = new OpenLayers.Protocol.Script();
|
||||||
$.getJSON(jsonp_url, function(data) {
|
jsonp.createRequest(layerURL, {
|
||||||
initMap(data);
|
f: 'json',
|
||||||
});
|
pretty: 'true'
|
||||||
|
}, initMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
function initMap(layerInfo){
|
function initMap(layerInfo){
|
||||||
@@ -93,7 +90,7 @@
|
|||||||
<p>
|
<p>
|
||||||
This method automatically configures the layer using the capabilities object
|
This method automatically configures the layer using the capabilities object
|
||||||
generated by the server itself. This page shows how to construct the url for the server capabilities object,
|
generated by the server itself. This page shows how to construct the url for the server capabilities object,
|
||||||
retrieve it using JSONP (and jQuery), and pass it in during construction. Note that in this case,
|
retrieve it using JSONP, and pass it in during construction. Note that in this case,
|
||||||
the layer is constructed before the map. This approach greatly simplifies the
|
the layer is constructed before the map. This approach greatly simplifies the
|
||||||
configuration of your map, and works best when all your tiles / overlays are similarly laid out.
|
configuration of your map, and works best when all your tiles / overlays are similarly laid out.
|
||||||
If you are using a live AGS map server for your layer, it can be helpful to check your
|
If you are using a live AGS map server for your layer, it can be helpful to check your
|
||||||
|
|||||||
Reference in New Issue
Block a user