1
Hello,
I have the following code:
$('#checar').click(function() {
$.ajax({
type: 'GET',
url: 'checar.php',
data: { lista: $('#lista').val() },
success: function(data) {
$('#sucesso').html(data);
}
});
});
HTML page that the above code is running:
<!DOCTYPE html>
<html>
<head>
<title>Checar Usuário</title>
</head>
<body>
<div id="sucesso"></div><br><br>
<textarea id="lista"></textarea>
<button id="checar">Checar</button>
</body>
</html>
check.php:
<?php
$usuario = $_GET['lista'];
$usuarios = 'usuario2|usuario4|usuario6|usuario8';
if(stristr($usuarios, $usuario) !== false) {
return true;
} else {
return false;
}
In the textarea, the user will inform the list of people he wants to check if they exist in the $usuarios
, then it will contain more than 1 line.
I wish that when the user clicked on Checar
, jQuery sent a GET request to each line, for example, it has 5 lines, each line containing usuario1|usuario2|usuario3|usuario4
, jQuery sent a GET request on these 5 lines, and grouped all entire lines that PHP returned as false, and all lines that PHP returned as true.
Thanks in advance.