Chris Mendez in Javascript, For Developers, Telematics

ArcGIS + ESRI + jQuery

This demo shows you how to use a ArcGIS map and ESRI data using jQuery. At this point, it's probably best to learn the DOJO framework but if you you only need to add a simple market on a map, jQuery will perform just fine.

$(function() {
  var map, locator, zip, lat, lng;

  function plotProject() {
    var loc = new esri.geometry.Point(lng, lat);
    var symbol = 
    new esri.symbol.PictureMarkerSymbol('https://s3.amazonaws.com/com.cartodb.users-assets.production/production/jonmrich/assets/20150203194453red_pin.png', 24, 24);
    var g = new esri.Graphic(loc, symbol);
    map.graphics.add(g);
  };


  var init = function() {
    lat = $("#map_lat").val();
    lng = $("#map_lng").val();
    var zoom = parseInt($("#map_zoom").val());
    map = new esri.Map("map_canvas",{
      basemap:"topo",
      center:[ lng, lat ], //long, lat
      zoom:zoom,
      infoWindow: new esri.dijit.Popup(null, dojo.create("div"))
    });
    dojo.connect(map, "onLoad", plotProject);
  };

  dojo.require("esri.map");
  dojo.require("esri.dijit.Popup");
  dojo.ready(init);

  $("#map_canvas").click(function() { 
    event.stopPropagation();          
  });


});

Resources