2
I have a file on the server that, if you find the login and password informed, returns 1
or 0
if nothing is found. However, I am unable to receive this information using XMLHttpRequest
. In PHP, I use echo (json_encode($))
to pass the value, but do not know how to take this value.
Here is 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);
}
}
}
}
There seems to be a URL formation error:
var url = "...hostoi.com/form_login.php/?login="...
Probably what you want to use isform_login.php?login
try to get the/
– MonneratRJ