title: Ajax Request to AWS API Gateway can not parse json response
body: <p>I am testing the code here:
  <a href="http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_ajax_get" rel="nofollow">http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_ajax_get</a></p>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  $(document).ready(function(){
  var processJSON =  function(data, textStatus, xhr) {
         alert(xhr.status);
      }
  // for whatever reason, the following URL is not working any more, so you won't be able to test it anymore.
    var myURL='https://ckeqt3eoea.execute-api.us-east-1.amazonaws.com/pettest/test?name=223';
  //  var myURL="https://jsonplaceholder.typicode.com/users"
  
      $("button").click(function(){
          $.ajax({
            url: myURL,
            dataType: "json",
            contentType: 'application/json',
            success: processJSON
          });
  
  
      });
  });
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;button&gt;Send Request&lt;/button&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>As indicated in the code, I am trying to parse the response from this URL:
  <a href="https://ckeqt3eoea.execute-api.us-east-1.amazonaws.com/pettest/test?name=223" rel="nofollow">https://ckeqt3eoea.execute-api.us-east-1.amazonaws.com/pettest/test?name=223</a></p>
  
  <p>And you can go to that URL directly and find out that the response from the <code>AWS-API-Gateway</code> is simply:</p>
  
  <pre><code>{
   "cc":"dd",
   "name":"ee"
  }
  </code></pre>
  
  <p>I was able to use the above javascript to parse other <code>json</code> responses from other sources. But I am pulling my hair trying to parse the above response from <code>AWS-API-Gateway</code>.
  if you uncomment the second line of <code>var myURL</code>, you will see that the code just really works for other URLs.</p>
  
  <p>========== </p>
  
  <p>In response to existing answers:</p>
  
  <ul>
  <li>I tried both <code>json</code> and <code>jsonp</code>. Both worked for other URLs (including the one I commented). But neither works for the AWS Gateway API.</li>
  <li>I also updated the code to use a named function. But again, it works for other URLs, but not for the AWS URL.</li>
  <li>I tested it on Firefox and Safari. </li>
  </ul>