Inside my Login
class I have this piece of code :
state={email:'',passwordHash:''};
onButtonClick = () =>{
if(this.state.email==='' || this.state.passwordHash==='')
return;
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (this.readyState === 4 && this.status === 200) {
console.log(this.responseText);
}
};
request.open('GET', 'http://localhost:8080/login/'+this.state.email+'/'+this.state.passwordHash, true);
request.send();
if(String(request.responseText).match("true"))
{
console.log("Inside Match");
window.location.href = '/home';
}
};
And in the console I get this :
As I'm getting true
in the console, I should also get Inside Match
in the console and then redirect, but that is not happening.
Can anyone help me with this problem ?
I have also tried ===
, ==
, single quote.