title: How to use a variable from a json to call another json in preload() function?
body: <p>I am using using p5js library in javascript.
  I used wrapAPI to make some custom APIs to grab posts and comments from the web.</p>
  
  <p>The first API returns the latest posts with the post ID. The second API returns comments of the post with the ID from the first API call.</p>
  
  <p>What is a good way to do this?</p>
  
  <p>My idea is to replace <code>idvox</code> and <code>categoria</code> inside <code>preload()</code> with:</p>
  
  <pre><code>idvox = datav.data.vox[1].idvox;
  </code></pre>
  
  <p>but the second <code>loadJSON()</code> function does not work. If I try to console.log or call the variable with the post id an empty <code>Object</code> or <code>undefined</code> value is returned.</p>
  
  <pre><code>function preload(){
  
      var datav = loadJSON('https://wrapapi.com/use/example/example/example/latest?wrapAPIKey=API_KEY');
      categoria = datav.data.vox[1].category;
      idvox = datav.data.vox[1].idvox;
      dataC = loadJSON('https://wrapapi.com/use/example/example/example/0.0.5?categoria='+categoria+'&amp;idvox='+idvox+'&amp;wrapAPIKey=API_KEY');
  }
  </code></pre>