I'm attempting to dynamically reload a section of my HTML with new data fetched through AJAX.
Within the code, there is a loop that iterates over clients:
{% for client in clients %}
After making an AJAX request and receiving updated client information,
$search = $request->request->get('data');
$clients=$this->getDoctrine()->getRepository(
Client::class)->findBy(array('name'=>$search));
$response = new JsonResponse();
$response->setStatusCode(200);
return $response->setData(['search' => $clients ]);
I am trying to replace the existing client data with this newly obtained set.
Is there a method to achieve this, or should I explore alternative approaches?
Appreciate your assistance!