I have a file on the server that, if I find the login and password informed, returns 1
or 0
if nothing is found. However, I am not able to receive this information using XMLHttpRequest
. In PHP, I use echo (json_encode($))
to pass the value, but I do not know how to get this value.
Here's my Javascript:
function logar()
{
var request = new XMLHttpRequest();
var url = "http://clleyton.hostoi.com/form_login.php/?login=" + document.getElementById("login").value + "&senha=" + document.getElementById("senha").value;
console.log(url);
request.open("GET", url, true);
request.onreadystatechange = function() {
if (request.readyState == 4)
{
if (request.status == 200 || request.status == 0)
{
console.log(request.responseText);
console.log(request.response);
}
}
}
}