title: How to call json object from AJAX?
body: <p>Here is my script:</p>
  
  <pre><code>$.ajax({ 
      type: "Get", 
      url: "Sample.js",
      datatype: 'json', 
      data: JSON.stringify({ key:key }), 
      success: function (data) { 
          var sample = data.name; 
          $("#html").html(sample); 
      }, 
      error: function () {
          alert("Error"); 
      }
  });
  </code></pre>
  
  <p>This is my <code>Sample.js</code> file:</p>
  
  <pre><code>{ "name": "user" }
  </code></pre>
  
  <p>When I run this code I get a blank screen. This is my script using <code>getJSON()</code>:</p>
  
  <pre><code>$.getJSON("Sample.js", function (data) { 
      var sample = data.name; 
      $("#html").html(sample); 
  })
  </code></pre>
  
  <p>This produces "user" perfectly. What is the problem with <code>$.ajax</code> code?</p>