title: Javascript callback after json parse
body: <p>I am pulling json from a different application and it only gets passed when the user does something in that application.</p>
  
  <p>Once I have pulled it in I am then checking to see if it equals 1 and then have a lot of other functions depending on true or false that need to be performed and only after this function has run.  </p>
  
  <p>I can stick all my functions in the if statements but is there a better way using callbacks?  </p>
  
  <pre><code>function retrieveData (retrieveDataJson){           
      data = JSON.parse(retrieveDataJson);
      user = data.id; 
      if (user === 1) {
      //do some stuff 
      }
      else {
          // do some other stuff
  
      }
  
  }
  </code></pre>