title: How to retrieve data from JSON file using Jquery and ajax?
body: <p>A weird thing happened to me today: I was trying to retrieve some data from a JSON file using jquery and ajax, and display this data on a webpage. This example, which I found on the Internet, worked for me on the base OS. When I try run it from a virtual machine with Win10 OS it doesn't work, meaning that it throws me to: <code>alert('There was a problem with the server.  Try again soon!');</code>. Why?
  Many thanks in advance!</p>
  
  <p>This is in my data19.json file:</p>
  
  <pre><code> {
    "one": "Learned Optimism",
    "two": "Deliberate Practice",
    "three": "Getting Things Done"
  }
  </code></pre>
  
  <p>My script, script19.js, is:</p>
  
  <pre><code>$(function() {  
    $('#clickme').click(function() {
         $.ajax({
         url: 'data19.json',
         dataType: 'json',
         success: function(data) {
            var items = [];
  
            $.each(data, function(key, val) {
  
              items.push('&lt;li id="' + key + '"&gt;' + val + '&lt;/li&gt;');    
  
            });
  
            $('&lt;ul/&gt;', {
               'class': 'interest-list',
               html: items.join('')
            }).appendTo('body');
  
         },
        statusCode: {
           404: function() {
             alert('There was a problem with the server.  Try again soon!');
           }
         }
      });
    });
  });
  </code></pre>
  
  <p>My HTML file is:</p>
  
  <pre><code> &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;19. Using jQuery to retrieve JSON via AJAX&lt;/title&gt;
    &lt;script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.7.1.min.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="script19.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;h1 id="title"&gt;19. Using jQuery to retrieve JSON via AJAX&lt;/h1&gt;
  
    &lt;a href="#" id="clickme"&gt;Get JSON Data&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Also when I click "Get JSON Data" this is what appears in Console:
  <a href="https://i.stack.imgur.com/D4lMK.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/D4lMK.jpg" alt="enter image description here"></a></p>