title: Synchronous javascript: How to continue script after input value is set?
body: <p>I have this javascript:</p>
  <pre><code>function getImage(input)
  { 
  status++;
  var base64 = $('#edit').croppie('result', {
      type: 'base64',
      size: 'viewport',
      format: 'jpeg',
      }).then(function(base64){
  
    $('#input').val(base64); // THIS SHOULD BE SYNCHRONOUS
    status--; // THIS SHOULD ONLY RUN AFTER THE #INPUT HAS ALREADY AN ASSIGNED VALUE ON THE PREVIOUS LINE
  
  });
  
  }
  </code></pre>
  <p>I need to execute the line with <code>status--;</code> only after <code>$('#input').val(base64);</code> on the previous line is securely finished.</p>
  <p>Is there some simple solution?</p>