It's hard for me to try adding a simple clickable marker to ArcGIS using pure JavaScript. All ArcGIS Samples seem to get their token and related pop-up information from the server. How can I achieve the same result using ArcGIS, like this Google Maps code example below?
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <div id="map" style="width: 500px; height: 500px;"></div> <script type="text/javascript"> window.onload = function() { var myOptions = { zoom: 2, center: new google.maps.LatLng(40, -75), mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map"), myOptions); var icon = new google.maps.MarkerImage("http://cinnamonthoughts.org/wp-content/uploads/2010/01/Custom-Marker-Avatar.png"); var markerOptions = { icon: icon, map: map, position: new google.maps.LatLng(37.7699298, -122.4469157), }; var marker = new google.maps.Marker(markerOptions); google.maps.event.addListener(marker, 'click', function() { var infoWindow = new google.maps.InfoWindow(); infoWindow.setContent("hello world"); infoWindow.open(map, marker); }); }; </script>
javascript google-maps arcgis
Langdon
source share