title: How to get data from api using visual studio 2019 and javascript?
body: <p>I want to get some data from the api and display on alert box with java script, but I have one error and cannot display the data.</p>
  <p>The error is:</p>
  <p><a href="https://i.stack.imgur.com/aX7kX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aX7kX.png" alt="js error after try to get data" /></a></p>
  <p>My code:</p>
  <pre><code>    &lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
      
      &lt;meta http-equiv=&quot;Content-Security-Policy&quot; content=&quot;default-src 'self'; img-src https://*; child-src 'none';&quot;&gt;
  
      &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js&quot;&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;script defer
              src=&quot;https://maps.googleapis.com/maps/api/js?key=AIzaSyCLLN5Uon6l2A41J2N0whRM7WQ9YAmRFeQ&amp;callback=initMap&quot;&gt;
      &lt;/script&gt;
  
  
      &lt;script type=&quot;text/javascript&quot;&gt;
  
          var markers = [
              { &quot;title&quot;: 'Населено място', &quot;lat&quot;: '41.19197', &quot;lng&quot;: '25.33719', &quot;description&quot;: 'Информация за населеното място' }
          ];
  
          window.onload = function () {
              LoadMap();
              DrawChart();
          }
  
          function LoadMap() {
  
              var mapOptions = {
                  center: new google.maps.LatLng(markers[0].lat, markers[0].lng),
                  zoom: 7,
                  minZoom: 7.5,
                  maxZoom: 10,
                  mapTypeId: google.maps.MapTypeId.TERRAIN
              };
  
              var infoWindow = new google.maps.InfoWindow();
              var latlngbounds = new google.maps.LatLngBounds();
              var map = new google.maps.Map(document.getElementById(&quot;dvMap&quot;), mapOptions);
  
              for (var i = 0; i &lt; markers.length; i++) {
                  var data = markers[i]
                  var myLatlng = new google.maps.LatLng(data.lat, data.lng);
                  var marker = new google.maps.Marker({
                      position: myLatlng,
                      map: map,
                      title: data.title,
                      icon: 'http://192.168.0.1/markers/marker.png',
                      opacity: 0.4
                  });
                  (function (marker, data) {
                      google.maps.event.addListener(marker, &quot;click&quot;, function (e) {
                          infoWindow.setContent(&quot;&lt;div style = 'width:300px;min-height:100px'&gt;&quot; + data.description + &quot;&lt;/div&gt;&quot;);
                          infoWindow.open(map, marker)
                      });
                  })(marker, data);
                  latlngbounds.extend(marker.position);
              }
              var bounds = new google.maps.LatLngBounds();
              map.setCenter(latlngbounds.getCenter());
              map.fitBounds(latlngbounds);
          }
  
        function async getData() {
  
          let url = `http://192.168.0.1:3000/?date=2019-10-20&amp;id=1010&amp;daysForward=8`;
  
          let response = await fetch(url);
  
          if (response.ok) {
              let json = await response.json();
              window.alert(json);
          } else {
            alert(&quot;HTTP-Error: &quot; + response.status);
          }
      }
  }
  
      &lt;/script&gt;
  
      &lt;div id=&quot;dvMap&quot; style=&quot;width: 100%; height: 600px&quot;&gt;
      &lt;/div&gt;
  
      &lt;div style=&quot;width: 100%; height: 270px&quot;&gt;
          &lt;canvas id=&quot;mixed-chart&quot; width=&quot;1000&quot; height=&quot;270&quot;&gt;&lt;/canvas&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>So the error is on this line:</p>
  <pre><code> let url = `http://192.168.0.1:3000/?date=2019-10-20&amp;id=1010&amp;daysForward=8`;
  </code></pre>
  <p>Can I take some example how to fix this issue ?</p>
  <p>I try a different methods to get the data from API but the error is the same with every method..</p>
  <p>This is a sceenshot of warnings...</p>
  <p><a href="https://i.stack.imgur.com/NHBLW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NHBLW.png" alt="Warnings" /></a></p>