title: Ajax ResponseText with If statement
body: <p>I am using Ajax to modify some data in a mysql database via a php file. I have written the code so that the php file echoes "OK" or "ERROR". I've checked with alert(ret) and it's working fine. But the problem is with the if (ret=="OK"). It's not getting inside this statement. Can anybody help me out?</p>
  
  <pre><code>xmlhttp=new XMLHttpRequest();
  xmlhttp.onreadystatechange=function(){
     if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200){
         document.getElementById('Store_cards_action_form_close').click();
         ret = xmlhttp.responseText;
         if (ret=="OK"){
             alert("Congratulations. Transaction Successful.");
             document.location.reload();      
         }
         else{
             alert("You have Insufficient Coins to buy this Card!");
         }
     }
  }
  xmlhttp.open("GET","script_card_transaction.php?" + para,true);
  xmlhttp.send();   
  </code></pre>