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

215
Views
Enviar datos a una base de datos MySql con ajax y json usando SYMFONY

Me gustaría poder recuperar los datos ingresados previamente en mi cuadrícula de datos. Sin embargo, no sé qué URL tengo que poner para poder guardar ni cómo declarar esto en mi controlador.

estoy usando Handonetable.js

Todavía no he creado mi entidad

Código de la cuadrícula de datos

 {# ---Affichage du datagrid--- #} <div id="travailEquipe" class="hot mt-4"></div> <button id="save" class="button button--primary button--blue">Save data</button> <script> {# ---Code du datagrid--- #} const container = document.querySelector('#travailEquipe'); const save = document.querySelector('#save'); const hot = new Handsontable(container, { data: [ ['', '',1 ,1 ,1 ,1 ,''], ['', '',1 ,1,1 ,1 ,''], ['', '',1 ,1 ,1 ,1 ,''], ['', '',1 ,1 ,1 ,1 ,''], ], className:'htCenter htMiddle', colHeaders: ['Nom Apprenant', 'Prénom Apprenant','Critère A', 'Critère B', 'Critère C', 'Critère D', 'Remarque'], columns: [{}, {}, { type: 'dropdown', source: [1, 2, 3, 4] }, { type: 'dropdown', source: [1, 2, 3, 4] }, { type: 'dropdown', source: [1, 2, 3, 4] }, { type:'dropdown', source: [1, 2, 3, 4] }, {}, ], contextMenu: true, width: '100%', height: 'auto', colWidths: [480, 480, 120, 120, 120, 120, 480], rowHeights:[40, 40, 40, 40, 40, 40, 40], manualColumnResize: true, licenseKey:'non-commercial-and-evaluation', }); {# --- Bouton de sauvegarde --- #} Handsontable.dom.addEvent(save, 'click', () => { // save all cell's data ajax('/docs/11.1/scripts/json/save.json', 'POST', JSON.stringify({ data: hot.getData() }), res => { const response = JSON.parse(res.response); if (response.result === 'ok') { save.innerText = 'Données sauvegardées'; } else { save.innerText = 'erreur de sauvegarde'; } }); }); </script>

parte de mi controlador

 /** * @Route("/TravailEquipe", name="TravailEquipe") */ public function TravailEquipe(): Response { return $this->render('pedagogie/TravailEquipe.html.twig', [ 'controller_name' => 'PedagogieController', ]); }

over 4 years ago · Santiago Trujillo
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!