Hi everyone,

XMLHttpRequest status returns 0. I am not sure why. I use relative URL, and I am using localhost. The response page is also on the same folder. So it is in the same domain. The code is as under:-

Code:
function getLike(value)
{
    var xhr;
    alert(value);
    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
        xhr=new XMLHttpRequest();
        alert("XMLHttpRequest1");
    }
    else
    {// code for IE6, IE5
        xhr=new ActiveXObject("Microsoft.XMLHTTP");
        alert("Microsoft.XMLHTTP1");
    }
    xhr.onreadystatechange=function()
    {
        alert(xhr.readyState);
        if (xhr.readyState==4)
        {
            alert(xhr.status);
            if (xhr.status==200)
            {
                document.getElementById("responseDIV").innerHTML=xhr.responseText;
            } 
        }
    }
    //alert("onreadystatechange");
    var likePath = "/Moms/babyNames/";
    var likeFile = likePath + "likeBabyName.php" ;
    var likeURL = likeFile + '?name='+ value;
    alert(likeFile);
    xhr.open("GET",likeURL,true);
    xhr.send();
}
likeBabyName.php has only one line as:

Code:
<?php
echo "LikedName";
?>
Response status is 0. I have looked in web for answers, but have not found any solution for my problem. If you can point to me where I am going wrong, I would be helped very much.

Thanks,
Priya