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

248
Views
Usando ajax para convertir entradas en JSON y POST a api

Tengo problemas para entender cómo se puede convertir la entrada de la etiqueta en JSON y luego publicarla en mi API.

Mi código de interfaz es

 <div> <form className="AddMentor"> <table> <tr> <td> <label>MentorID<input type="text" name="MentorID" /></label> </td> <td> <label>MentorName<input type="text" name="MentorNAME" /></label> </td> <td> <label>MentorEMAIL<input type="text" name="MentorEMAIL" /></label> </td> <td> <label>MentorPH<input type="text" name="MentorPH" /></label> </td> <td> <label>MentorLINKEDIN<input type="text" name="MentorLINKEDIN" /></label></td> <td> <label>MentorPM<input type="text" name="MentorPM" /> </label> </td> </tr> </table> <button type="submit" id="save">Add Mentor</button> </form> </div>

Y MI código api es

 //ADD MENTOR API router.route('/MentorEle').post((request,response)=>{ let Mentor = {...request.body} dboperations.addMentor(Mentor).then(result => { response.json(result); }) })

Intenté esto para convertirlo en JSON y PUBLICAR en mi api

 $(document).on('click', '#save', function(event) { event.preventDefault(); var data = $('tr').map(function() { var obj = {}; $(this).find('input, select').each(function() { obj[this.name] = $(this).val(); }); return obj; }).get(); console.log(JSON.stringify(data)); });

Desafortunadamente, no funcionó, enfrenté varios errores y el error actual es

Módulo no encontrado: Error: No se puede encontrar el archivo: 'node-jquery.js' no coincide con el nombre correspondiente en el disco: '.\node_modules\jquery\lib\jQuery'.

por favor, alguien que me ayude con este código o el enfoque ajax de él

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!