I have a simple script, in ajax, and I want to capture the return and process it according to the value:
if (xmlhttp.readyState==4) {
    if (xmlhttp.responseText == "not available") {
        document.write("not available");
    }
}
At the same time, I tried this, which worked:
if (xmlhttp.readyState==4) {
    document.write(xmlhttp.responseText);
}
What wrong am I doing?
Thank you for your reply. This is my current domain availability checking script which works great:
    <html>
    <head>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                $('#dtype').change(function() {
                    var opt = $('#domain').val();
                    $.ajax({
                        type: "POST",
                        url: "testwhois.php",
                        data: 'd=' + opt,
                        success:function(data){
                            $('#txtHint'). html(data);
                        }
                    });
                });
            });
        </script>
    </head>
<body>
 <form>  Domain name : <input type="text" name="domain" id="domain"> <input type="radio" name="dtype" id="dtype" value="new">New <input type="radio" name="dtype" value="transfer">Transfer  <span id="txtHint"></span> </form>
</body>
</html>
However, I want to have two things in it:
- a preloader image (I have it) while the script is working in the place of 'txtHint' where the answer will be displayed. 
- The answer is returned in the format of "not available" or available". I want to make the 'domain' field blank, when the answer is returned as "not available" with the html codes. 
Thanks again.
 
     
     
    