Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

98
Views
Symfony and Jquery search

I try a search form for my users,

My controller works correctly, but my jquery code doesn't work.

If I go to the network I can see the URL of the search and the result of the search. The console doesn't show alerts.

Capture: of network https://i.stack.imgur.com/40R6x.png

I use a semantic UI for my search form.

controller

   /**
     * @Route("/api/users", name="searchUserApi", methods="GET")
     */

    public function searchUserApi(Request $request)
    {
        $query = $request->query->get('nombre');
        $em = $this->getDoctrine()->getManager();

        $dql = "SELECT u FROM App\Entity\Asistente u 
                WHERE u.nombre LIKE :query OR u.correo LIKE :query";
        $users = $em->createQuery($dql)
            ->setParameter('query', '%'.$query.'%')
            ->getResult();
        $list = [];

        foreach ($users as $user){
            $list[] = [
                'nombre' => $user->getNombre(),
                'correo' => $user->getCorreo(),
            ];
        }

        return new JsonResponse($list);
    }

form semactic ui

<div class="ui search">
  <div class="ui icon input">
    <input class="prompt" type="text" id="nombre" placeholder="Search...">
    <i class="search icon"></i>
  </div>
  <div class="results"></div>
</div>

jquery

<script type="text/javascript">
$('.ui.search')
   .search({
    apiSettings: {
      url: 'https://127.0.0.1:8000/api/users?nombre={query}'
    },
    fields: {
      title   : 'nombre',
      description: 'email'
    },
    minCharacters : 3
  })
;
</script>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!