I have an Ajax query:
$(document).ready(function(){   
  $("#amis_commun_liste .afficher_plus_modal").bind('click',function f(){
    var afficher_plus_modal = $(this).attr("class");
    var id = "<?php  echo $_GET['id']; ?>";
    $(this).unbind('click',f);
    $.ajax({
      type: "post",
      url: "voir_profil_includes/func_infos.php",
      data: {
        "afficher_plus_modal": afficher_plus_modal,
        "id" : id           
      },
      beforeSend: function() {
        $("#amis_commun_liste .afficher_plus_modal").html("En cours");
      },
      success: function(data) {
        if (data =="success") {                          
          //Treatment area after successful operation
        }
      }
    });
  });
});
The Ajax query calls this php / mysql query into func-infos.php:
if (!empty($_POST['afficher_plus_modal'])) {
   require("../voir_profil_includes/connect_db.php");
    $infos = [];
    $q = $bdd->prepare(" SELECT u.id,
  u.nom, u.prenom, u.avatar,u.couverture
FROM users u
INNER JOIN
(
  SELECT id_exp, id_des
  FROM friends
  WHERE id_exp IN(:id_exp, :id_des)
    AND active = 1
  UNION
  SELECT id_des, id_exp
  FROM friends
  WHERE id_des IN(:id_exp, :id_des)
    AND active = 1
) tmp ON tmp.id_des = u.id
GROUP BY u.id
HAVING COUNT(*) = 2
ORDER BY RAND() LIMIT 5
");
     $q->execute(array(
                    "id_exp" => $_POST["id"],
                    "id_des" => info_profil()->id
                    ));
      while ($info = $q->fetch(PDO::FETCH_OBJ)) {
             $infos[] = $info;               
             }      
     // return data after operation
        return $infos;
     //informs Ajax that the operation has been carried out
     echo "success";
}
This code does not produce errors but I do not know how I could retrieve the data returned from func_infos.php to update the "list_am_commun.php" page by displaying the new data in list_am_commun.php.
Thank you but I know it will not be a simple job.
 
     
    