Use jquery + php. Doing custom AJAX captcha. i.e user clicks on image, it automatically updates.
<script src="/js/jquery.js"></script>
<script>
$(document).ready(function(){
$.post('/captcha.php', {}, function(resp){
$("div").html(resp);
});
});
</script>
<div></div>
in PHP header already sent, so if it includes into <img src="/captcha.php" /> 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.
If you want to change an image in an HTML document, then change the src attribute of the image (or replace the image element with a new one). Don’t use XMLHttpRequest at all.