My head is about to explode. I cannot figure out what is going on here. Below is my code for handling a ajax request.
 xmlhttp_DELrep.onreadystatechange = function(){
    if(xmlhttp_DELrep.readyState == 4 && xmlhttp_DELrep.status == 200){
        if(xmlhttp_DELrep.responseText == 'delete_ok'){
            document.getElementById(replyboxID).style.display='none';
            console.log('delete success!');
        }else{
            console.log('delete fail');
            console.log('xmlhttp_DELrep.responseText: '+ xmlhttp_DELrep.responseText);
        }
    }
}
This is the response that I am getting through the console:
 delete fail
 xmlhttp_DELrep.responseText: delete_ok
I do not understand why my first 'if' statement is not executing given that the xmlhttp_DELrep.responseText does indeed equal 'delete_ok' - as shown in the console. Please can someone help?
 
     
    