title: How to access RESPONSE data from an AJAX Get in JQuery
body: <p>This is my first attempt at using an AJAX GET to pull data and it is really causing me a nightmare. I have used POST loads of times and assumed accessing the data would be the same basic process, but no matter what I try I always end up with &quot;Undefined&quot;.</p>
  <p>This is the code I have been trying to make the GET work in my script;</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>$(document).ready(function() {
      $.ajax({
          type: "GET",
          url: "/buytoken/public/api/stage?secret=***************",
          cache: false,
          dataType: "json",
              success : function(response){
              var len = response.length;
              for(var i=0; i&lt;len; i++){
              var sold = response[i].progress;
              }
              alert(sold);
              }
      });
  });</code></pre>
  </div>
  </div>
  </p>
  <p>This is then what the response should be;</p>
  <p>{
  &quot;success&quot;: true,
  &quot;response&quot;: {
  &quot;ico&quot;: &quot;running&quot;,
  &quot;total&quot;: &quot;8,000,000&quot;,
  &quot;total_amount&quot;: &quot;800,000&quot;,
  &quot;sold&quot;: &quot;1,599,300&quot;,
  &quot;sold_amount&quot;: &quot;159,930&quot;,
  &quot;progress&quot;: 20,
  &quot;price&quot;: &quot;0.1&quot;,
  &quot;start&quot;: &quot;2022-02-28 00:01:00&quot;,
  &quot;end&quot;: &quot;2022-05-31 00:01:00&quot;,
  &quot;timezone&quot;: &quot;Europe/London&quot;,
  &quot;min&quot;: &quot;500&quot;,
  &quot;max&quot;: &quot;4000000&quot;,
  &quot;soft&quot;: &quot;400000&quot;,
  &quot;soft_amount&quot;: &quot;40,000&quot;,
  &quot;hard&quot;: &quot;800000&quot;,
  &quot;hard_amount&quot;: &quot;80,000&quot;
  }
  }</p>
  <p>The script that I am trying to access is on the same webserver.</p>
  <p>It is coming from a third-party piece of software that we are running on the site. The documentation states &quot;Application provides some specific internal live data in JSON&quot;</p>
  <p>So, we should be getting JSON back.</p>
  <p>I need to access just two pieces of data &quot;sold_amount&quot; and &quot;progress&quot; which I want to load into variables in the Success callback.</p>
  <p>I really would be grateful if somebody could explain or better still show me how this is supposed to work because I am really banging me head against the wall on this.</p>
  <p>Also, if I need to add any extra bits like error handling then please point that out.</p>
  <p>Thanks to anybody who responds to this..</p>