title: How to set HTTP header img-type jpeg/png in AJAX when updating captcha?
body: <p>Use jquery + php. Doing custom AJAX captcha. i.e user clicks on image, it automatically updates.</p>
  
  <pre><code>&lt;script src="/js/jquery.js"&gt;&lt;/script&gt;
  
  &lt;script&gt;
  
  $(document).ready(function(){
  
      $.post('/captcha.php', {}, function(resp){
  
          $("div").html(resp);
  
      });
  
  });
  
  &lt;/script&gt;
  
  &lt;div&gt;&lt;/div&gt;
  </code></pre>
  
  <p>in PHP header already sent, so if it includes into <code>&lt;img src="/captcha.php" /&gt;</code> it prints captcha in jpeg. The problem seem to be is header that need to be sent. So, how can i do this? The header is sent in PHP. It doesnt work in js.</p>