Greetings, I have this JS code where I use AJAX ($ ("# pass") is the password of the form):
function egiaztatuPasahitza(){
var data = $("#pass");
var request = $.ajax({
url:'egiaztatuPasahitza.php',
data: data,
dataType:'html'
});
request.done(function(data){
if(data == true) {
alert("true");
} else {
alert("false");
}
});
request.fail(function(data){
});
};
Who calls this PHP code:
$pasahitzak = fopen('../DATUAK/toppasswords1.txt','r');
$pass = $_REQUEST[data];
while ($linea = fgets($archivo)) {
$aux[] = $linea;
$numlinea++;
echo "<script>console.log( 'Pasahitza: " . "$pass" . "' );</script>\n";
if("$pass"=="$linea"){
echo "<script>console.log( 'Pasahitza: " . "$pass" . "' );</script>\n";
echo "true";
}else{
echo "false";
}
}
fclose($pasahitzak);
This code reads a file line by line to compare it with a password that comes from a form.
My problem is that when making lines like this:
echo "<script>console.log( 'Lerroa: " . "$linea" . "' );</script>";
The console does not read it and only the information of the request comes out like this (there is nothing more than the drop-down even if it closes it):
I think there is nothing wrong in the code but I do not know why it does not register it in the console. I tried to change it for an alert () and neither does it. Greetings.