I am using ArcGIS map which gives me an error:

enter image description here

Below is my function which i am using to implementing the map on my application:

function handlerForVariableB (latt, longt, complaintid)

  // execute code that is relevant when "$a" was set on the server-side. 
    type: "GET",
    url:  "tools/nrega_v2.1/map.php",
    data: 'complaintid='+complaintid,
    success: function(data){         
      var data_array = JSON.parse(data);


  var hrymap='<div id="hrymap"></div>';


    $('#hrymap').html("<div id='map' style='width:850px;height:650px;'><div id='BasemapToggle'></div></div>");
          //var map;

      var map;

        "esri/map", "esri/views/MapView", "esri/widgets/BasemapToggle",
        "esri/layers/GraphicsLayer", "esri/symbols/PictureMarkerSymbol","esri/layers/ArcGISDynamicMapServiceLayer","esri/layers/ArcGISTiledMapServiceLayer",
      ], function(
        Map,  MapView,
  BasemapToggle,Point, SimpleMarkerSymbol, Graphic, GraphicsLayer,PictureMarkerSymbol,ArcGISDynamicMapServiceLayer,ArcGISTiledMapServiceLayer
      ) {
        map = new Map("map", {
          basemap: "<?php echo $basemap; ?>",
      center: [longt,latt],
          zoom: "<?php echo $zoomlevel; ?>",

         var view = new MapView({
    container: "viewDiv",
    map: map,
    center: [-86.049, 38.485],
    zoom: 3

  // 1 - Create the widget
  var toggle = new BasemapToggle({
    // 2 - Set properties
    view: view, // view that provides access to the map's 'topo' basemap
    nextBasemap: "hybrid" // allows for toggling to the 'hybrid' basemap
 view.ui.add(toggle, "top-right");

        map.on("load", function() {
          var gl = new GraphicsLayer();
          var p = new Point(longt,latt);

     var s = new PictureMarkerSymbol('img/location.png', 51, 51);

          var g = new Graphic(p, s);
          map.addLayer(new ArcGISDynamicMapServiceLayer('<?php echo $roadlayers; ?>'));





Below are the js and css which are using in my application:

<link rel="stylesheet" href="inc/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="inc/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="inc/css/ionicons.min.css">
  <!-- jvectormap -->
   <!-- Theme style -->
  <link rel="stylesheet" href="inc/css/AdminLTE.min.css">
<link rel="stylesheet" href="css/global.css">
<link href="css/custom.css" type="text/css" rel="stylesheet">
  <link rel="stylesheet" href="inc/css/skins/_all-skins.min.css">
  <link rel="stylesheet" href="inc/css/custom.css">
  <link rel="stylesheet" href="inc/style.min.css">
 <link rel="stylesheet" href="leafletslib/leaflet.css" />
  <script src="leafletslib/leaflet.js"></script>
  <script src="js/jquery-3.4.1.min.js"></script>
    <script src="lib/jquery.crypt.js"></script>
    <script src="lib/jquery.validarium.js"></script>
    <link rel="stylesheet" href="https://js.arcgis.com/3.29/esri/css/esri.css">
    <script src="https://js.arcgis.com/3.29/"></script>
  <script src="js/bootstrap.min.js"></script>
  • You are trying to load esri/views/MapView from the wrong version of ArcGIS Javascript API. This class exists on version 4.x of the API, not 3.29. – isshp Jul 23 '19 at 6:59
  • I am getting the same error with 4.11 version – sumit kundan Jul 23 '19 at 7:14
  • Loading failed for the <script> with source “js.arcgis.com/4.11/esri/layers/ArcGISDynamicMapServiceLayer.js”. – sumit kundan Jul 23 '19 at 7:17
  • Once again, you're mixing up classes from two different versions. esri/layers/ArcGISDynamicMapServiceLayer belongs to version 3.x. You should decide which version you want to use and then find the relevant classes from API. Use the documentation: v3.x or v4.x – isshp Jul 23 '19 at 7:29
  • i need actually basemap toggle with simplemarker please suggest me which relevan class i use to achieve my requirement – sumit kundan Jul 23 '19 at 7:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.