I have the following code:
$.ajax({
type:"post",
url:"../connect/post/infoClienteTask.php",
data:'infoClienteTask='+fantasy,
success:function(responseData){
console.log(responseData);
$(".historic-cliente").html('<li class="list-group-item">'+responseData.Project+' - '+responseData.Delivery+'</li>');
}
});
That by clicking on a list of clients, it shows the whole history of the client, but with this code I can only find the first one of the search.
In PHP I have the following codes.
POST:
header( 'Content-Type: application/json; charset=UTF-8' );
$selInfoClienteTasks= new Tasks();
if($_SERVER['REQUEST_METHOD']=='POST'){
$fantasy = $_POST['infoClienteTask'];
$stInfoClienteTasks = $selInfoClienteTasks->selectInfoClienteTask($fantasy);
echo json_encode($stInfoClienteTasks);
exit();
}
SELECT:
public function selectInfoClienteTask($fantasy){
try {
$stmt = $this->conn->prepare("SELECT tasks.*, DATE_FORMAT( tasks.Delivery , '%d/%m/%Y' ) as Delivery FROM Tasks WHERE CompanyFantasy = '$fantasy'");
$stmt->execute();
return $stmt->fetch(PDO::FETCH_ASSOC);
}catch (PDOException $exception){
header("Location: ./error.php?err=Unable-to-find-info");
echo 'Error: '.$excption->getMessage();
return null;
}
}
I need to do a While / Foreach / For in this Ajax to continue searching until I find all the information, p>